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.