Simple Programs Sheet
Simple Programs Sheet
//simple programs
Q1. WAP to read two integer numbers. Calculate and print:-
i) Addition of numbers
ii) Subtraction of numbers
iii) Multiplication of numbers
iv) Division of numbers
v) Modulus of numbers
Q2. WAP to read two fractional numbers. Calculate and print:-
i) Addition of numbers
ii) Subtraction of numbers
iii) Multiplication of numbers
iv) Division of numbers
Note:- Modulus operator should not be used with fractional numbers( Logically it is an
error).
Q3. WAP to read two numbers calculate and print the average of two numbers.
Q4. WAP to read three numbers calculate and print the average of three numbers.
Q5. WAP to read four numbers calculate and print the average of four numbers.
Q6. WAP to read the time in minutes convert it into equivalent hours and seconds and print it.
Q7. WAP to read the time in seconds convert it into equivalent hours and minutes and print it.
Q8. WAP to read the time in hours convert it into equivalent minutes and seconds and print it.
Q9. WAP to read the distance in centimeter convert it into equivalent meter and kilometer and
print it.
Q10. WAP to read the distance in meter convert it into equivalent centimeter and kilometer and
print it.
Q11. WAP to read the distance in kilometer convert it into equivalent centimeter and meter and
print it.
Q12. WAP to read the principal amount, rate of interest, and time. Calculate simple interest
and print it.
Q13. WAP to read two numbers. Interchange it and print it.
i) With the help of 3rd number
ii) Without using 3rd number
Q14. WAP to read the Side of Square. Calculate and print:-
i) Area of square (side * side)
ii) Perimeter of square (4 *Side)
Q15. WAP to read the length and breadth of Rectangle. Calculate and print:-
i) Area of Rectangle (length * Bredth)
ii) Perimeter of Rectangle ( 2*(length + Bredth))
Q16. WAP to read the radius of circle. Calculate and print:-
i) Area of Circle (3.14 * radius * radius)
ii) Circumference of Circle(2 *3.14 * radius)
Q17. WAP to read the Side of cube. Calculate and print:-
iii) volume of cube(side* side * side)
iv) Surface Area of cube (6 * side * side)
1|Page
Q18. WAP to read the length, breadth and height of cuboid. Calculate and print:-
i. Volume of cuboid (length * breadth * height)
ii. Surface Area of Cuboid ( 2 * (length* breadth + breadth*height + height*length))
Q19. WAP to read the radius of sphere. Calculate and print:-
i. Volume of sphere (4/3 * 3.14 * radius * radius * radius)
ii. Surface area of sphere (4 * 3.14 * radius * radius)
2|Page