Worksheet 2 (Basic)
Worksheet 2 (Basic)
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.
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.