Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Goal: Use selection and repetition to write a program which uses functions Problem Statement - A program is required which will act as a calculator.
Goal: Use selection and repetition to write a program which uses functions Problem Statement - A program is required which will act as a calculator. The program should prompt the user to enter 2 integers and a code. The program should perform the following actions based on the code entered . A code of 1 indicates that the two numbers should be added . A code of 2 indicates that the two numbers should be multiplied A code of 3 indicates that the first number should be divided by the second number A code of 4 indicates that the first number should be subtracted from the second . umber. The program should then print both numbers, with appropriate labels as well as the sum difference, product or quotient with an appropriate label indicating what is being printed. This process should be repeated until 2 zeros are entered. An appropriate message should then be printed to notify the user of thee Sample Output Please enter a number3 Please enter another number 6 Please enter the code 1 The first number is 3 and second number is 6. The sum of these numbers is 9 Please enter a number4 Please enter another number 5 Please enter the code 2 The first number is 4 and the second number is 5. The product of these numbers is 20 Please enter a number 0 Please enter another number 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started