Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Lab Exercise 04

1. Write a program to ask two inputs from the user. From the number given, you
could perform three selections: addition, multiplication and division. Print the
result based on your choice:
Sampel output:
Please type in two numbers: 12

Enter a select code:


1. For addition
2. For multiplication
3. For division
Your choice for code is: 2
The product of the numbers entered is 36

2. Write a program that displays the following menu:


Sampel output:
Shape Calculator
1. Calculate the Area of a Circle
2. Calculate the Area of a Rectangle
3. Calculate the Area of Triangle
4. Quit
Enter your choice (1-4):

If the user enters 1, the program should ask for the radius of the circle
and then display its area.

If the user enters 2, the program should ask for the length and width of
the rectangle and then display its area.

If the user enters 3, the program should ask for the base and height of
the triangle and then display its area.

If the user enters 4, the program should end (eg: display thank you)

Formula:
Circles area =r2
Rectangles area = length x width
Triangles area = base x height x 0.5

Faculty of Information and Computing Technology | BTT121 | Page 1 of 1

You might also like