Professional Documents
Culture Documents
Examples With Loops 2 - Without Solutions
Examples With Loops 2 - Without Solutions
4. Write a program in C++ to divide two numbers and print on the screen.
Sample Output:
Divide two numbers and print:
----------------------------------
The quotient of 30 and 10 is : 3
5. Write a program in C++ that takes a number as input and prints its
multiplication table upto 10.
Sample Output:
Print the multiplication table of a number upto 10:
--------------------------------------------------------
Input a number: 5
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Sample Output:
Print the area and perimeter of a rectangle:
----------------------------------------------
Input the width of the rectangle: 8.5
Input the height of the rectangle: 5.6
The area of the rectangle is: 47.6
The perimeter of the rectangle is: 28.2
9. Write a program in C++ to enter two angles of a triangle and find the
third angle.
Sample Output:
Find the third angle of a triangle :
-----------------------------------------
Input the 1st angle of the triangle : 35
Input the 2nd angle of the triangle : 35
The 3rd of the triangle is : 110
10. Write a program in C++ to print the sum of two numbers using variables.
Print the sum of two numbers :
-----------------------------------
The sum of 29 and 30 is : 59