Question
Write a calculator program that does addition, subtraction, multiplication and division. ANSWER IN C LANGUAGE ! Use the algorithm provided below to help create your
Write a calculator program that does addition, subtraction, multiplication and division. ANSWER IN C LANGUAGE ! Use the algorithm provided below to help create your C program:
Algorithm for simple 4-function calculator:
Inputs: (from user or file or wherever)
User provides the operation and two operands
Outputs: (text description of what the algorithm will output)
Program outputs the results of the operation.
Relevant Constants and Formulas:
Main Algorithm (numbered steps)
1. Print welcome message 2. Prompt the user for the operation 3. Perform correct operation 4. Output result to user
Step 3 has four variations, depending on the operation selected by the user.
3a Addition 3a. 1 prompt the user for the two operands to be added 3a. 2 return the sum of the two operands
3b Subtraction 3b. 1 prompt the user for the first operand (Minuend) 3b. 2 prompt the user for the second operand (Subtrahend) 3b. 3 return the difference (Minuend - Subtrahend)
3 Multiplication 3c. 1 prompt the user for the two operands to be multiplied 3c. 2 return the product of the two
3d Division 3d .1 prompt the user for the dividend 3d .2 prompt the user for the divisor 3d .3 check to ensure the divisor is not 0 3d .4 return the quotient of dividend/divisor
Will give good rating if solved correctly !
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