0% found this document useful (0 votes)
54 views5 pages

Worksheet 2 (Basic)

This document contains a worksheet with 10 programming problems: 1) Display "Hello World!" 2) Display a greeting across 3 lines 3) Display a name instead of the greeting 4) Display nested asterisk designs 5) Display an addition problem and solution 6) Perform and display other math operations on numbers 7) Display the square root of a number 8) Calculate and display the value of expression A 9) Calculate and display if expression B is true or false 10) Write a program to compute trigonometric functions of a number

Uploaded by

m
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views5 pages

Worksheet 2 (Basic)

This document contains a worksheet with 10 programming problems: 1) Display "Hello World!" 2) Display a greeting across 3 lines 3) Display a name instead of the greeting 4) Display nested asterisk designs 5) Display an addition problem and solution 6) Perform and display other math operations on numbers 7) Display the square root of a number 8) Calculate and display the value of expression A 9) Calculate and display if expression B is true or false 10) Write a program to compute trigonometric functions of a number

Uploaded by

m
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

MicroLink Information Technology College

Department of Computer Science


CSSE-133 Programming Fundamentals I
Worksheet 2 (Basic Programming)

1. Write a program that displays “Hello World!” on the screen.


2. Change the display text to print “Hello” on the first line, “World” in next line and “!” in next
on three separate lines. Like
Hello
World
!
3. Modify the above question so that display your name on the screen.
4. Displays the following design using \n, \t, and endl.
a. *
* *
* * *
* * * *

b. *
* * *
* * * * *
* * * * * * *
* * * * *
* * *
*

5. Write a program that add any two numbers and displays the sum result in the
following format. You should see it printing:
3 + 2 = 5
6. Change the program to subtract, multiply and divide one number from the
other.
7. Write a program that displays the square root of a number.
8. Find the value of A for the following: (Test your answer by writing the code)
A = ( 5 + 2 * 3 + (( 3 – 2 ) * 7) + -9 ) / 2.
9. Find the value of B (true or false) for the following: (Test your answer by
writing the code)
i= 5;
j = 9;
B = ! (( i > 0 ) && ( i >= j ));
10. Write C++ program to read x and compute sin, cos, and tan of x.

MicroLink Information Technology College


Department of Computer Science
CSSE-133 Programming Fundamentals I
Worksheet 2 (Basic Programming)

1. Write a program that displays “Hello World!” on the screen.


2. Change the display text to print “Hello” on the first line, “World” in next line
and “!” in next on three separate lines. Like
Hello
World
!
3. Modify the above question so that display your name on the screen.
4. Displays the following design using \n, \t, and endl.
a. *
* *
* * *
* * * *

b. *
* * *
* * * * *
* * * * * * *
* * * * *
* * *
*

5. Write a program that add any two numbers and displays the sum result in the
following format. You should see it printing:
3 + 2 = 5
6. Change the program to subtract, multiply and divide one number from the
other.
7. Write a program that displays the square root of a number.
8. Find the value of A for the following: (Test your answer by writing the code)
A = ( 5 + 2 * 3 + (( 3 – 2 ) * 7) + -9 ) / 2.
9. Find the value of B (true or false) for the following: (Test your answer by
writing the code)
i= 5;
j = 9;
B = ! (( i > 0 ) && ( i >= j ));
10. Write C++ program to read x and compute sin, cos, and tan of x.

You might also like