Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 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 two numbers should be divided by the second number.

- A code of 4 indicates that the two numbers should be subtracted by the second number.

The program should then print both numbers, 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 the end of the program.

Sample Output

Please enter a number 3

Please enter another number 6

Please enter the code 1

The first number is 3 and second number s 6.

The sum of three numbers is 9

Please enter a number 4

Please enter another number 5

Please enter the code 2

The first number is 3 and second number is 6.

The sum of three numbers is 9

Please enter a number 0

Please enter another number 0

Good Bye !

Your program MUST use at least 2 value return functions (excluding the main functions) and must use a loop.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

ISBN: 1461368332, 978-1461368335

More Books

Students also viewed these Databases questions