C program The program will prompt the user to choose the operation choice (from 1 to 4). Then it asks the user to input two integer vales for the calculation. See the sample below. MENU 1. Add 2. Subtract 3. Multiply 4. Divide Enter your choice: 1 Enter your two numbers: 12 15 Result: 27 Continue? y The program also asks the user to decide whether he/she wants to continue the operation. If he/she input ‘y’, the program will prompt the user to choose the operation again. Instead, the program will terminate. The program must use a separate function for each mathematical operation. (Do not use printf or scanf inside the function ... all input/output should be in main)
C program
The program will prompt the user to choose the operation choice (from 1 to 4). Then it asks the user to input two integer vales for the calculation. See the sample below.
MENU
1. Add
2. Subtract
3. Multiply
4. Divide
Enter your choice: 1
Enter your two numbers: 12 15
Result: 27
Continue? y
The program also asks the user to decide whether he/she wants to continue the operation. If he/she input ‘y’, the program will prompt the user to choose the operation again. Instead, the program will terminate.
The program must use a separate function for each mathematical operation.
(Do not use printf or scanf inside the function ... all input/output should be in main)
Introduction
In C, the switch statement is an alternative to the if-else-if ladder statement that enables us to do several operations for the various potential values of a single variable called the switch variable. Here, we can define different statements in a variety of situations for varied values of a single variable.
Step by step
Solved in 4 steps with 3 images