c. Write a complete program that can displays output as shown in the samples in Figure 2.1 The program will prompt the user for two (2) integer numbers. Then, the program will display a calculator menu and prompt the user to enter his choice. If the user enters 1 / 2 / 3, the program will perform the calculation according to the choice, display the result of the calculation and end the program. If the user enters 4, the program will display "Exit" and ends. An error message "Invalid input" will be displayed if the user enters a number outside the range of 1 - 4. lease enter at teri a Piease enter and unber i 1 Please enter lat uberi e Piease enter and nunber lease enter lst nube lease enter and nuber Zease enter et ease enter and n kaleulator kateutator caleulater . Ad te nubers 2. Sutract te nubers b. Mitiply tvo ubers . Quit Add te nunbers Subtract te nbers Mltiply te nubers . it Add te nuters 2. Suetract te nuters P. itiply to ubers . Quit Add te nuters 2. Sutrect te ters b. itiply twe nubers . Quit nter your chelce(1- 4): Enter your choice(1 4)I1 Enter your cheice(4) Enter your choice(1- 4) 14 2. 21- 252 Invalid input Samples of output
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
![MTE BITP 1113 Programming Technique - Word
A ahmed garcad AG
File
Home
Insert
Draw
Design
Layout
References
Mailings
Review
View
Help
Acrobat
O Tell me what you want to do
& Share
'Paragraph Spacing -
A
O Effects
Aa
TITLE
Title
Title
Title
TITLE
Title
Title
Title
Title
TITLE
TTLE
He
HE
1 Hnc
Headio
Heading!
Heading1
HEADING
!
Headine
Heading1
Themes
Colors Fonts
Watermark Page Page
O Set as Default
Color v Borders
Document Formatting
Page Background
c. Write a complete program that can displays output as shown in the samples in Figure 2.1
The program will prompt the user for two (2) integer numbers. Then, the program will
display a calculator menu and prompt the user to enter his choice. If the user enters 1 / 2
/ 3, the program will perform the calculation according to the choice, display the result
of the calculation and end the program. If the user enters 4, the program will display
"Exit" and ends. An error message "Invalid input" will be displayed if the user
enters a number outside the range of 1
- 4.
Please enter 1st nunber 1 12
Please enter and nunber : 21
Please enter ist nunber 1 70
Please enter 2nd number : 45
Please enter 1st number : 48
Please enter 2nd numbe I se
Please enter ist number : 77
Please enter 2nd nurbe : 10
Calculator
Calculator
Calculator
Calculator
1. Add two numbers
2. Subtract two numbers
p. Multiply two numbers
4. Quit
1
1. Add two nunbers
2. Subtract to nunbers
b. Muleiply tuo nunbers
4
1. Add two numbers
E. Subtract two numbers
b. Multiply two numbers
. Quit
.Add to nunbers
Subtract two nunbers
b. Multiply twe nunbers
4. Quit
. Quit
Enter your cholce(1. 4):
Enter your choice(1- 4)1
Enter vour choice(i - 4) : 7
Enter your choice(1- 4) I4
12. 21- 252
pe+ 45- 11S
Invalid input
Exit
Samples of output
Figure 2.1
-5-
CONFIDENTIAL
Page 5 of 11
932 words
D* English (United States)
80%
5:29 AM
O Type here to search
IA
25
W
27°C
G 4») ENG
25/11/2021
(21](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F63bd909b-59ae-4923-890f-f53e8d6bf776%2Ff189d299-5cdf-4881-a1b9-108aed960c05%2Fogtu0p8_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)