Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in C please Write a calculator program that asks the user for 2 integers, then ask them what operation they want to perform (addition, subtraction,
in C please
Write a calculator program that asks the user for 2 integers, then ask them what operation they want to perform (addition, subtraction, multiplication, or division). Ask the user for the 2 numbers in the main function, then use functions to perform the operations. For division, divide the first number by the second number, and print 2 decimal places. For Subtraction, subtract the first number from the second number For this program, you simply need to fill in the "TODO" pieces. Do not edit the function names or parameters. They must be what is provided For reference, they are listed below: - Performaddition - Performsubtraction - PerformMultiplication - PerformDivision //I///1/ Do not edit these Lines //1/1//1/ int Performaddition (int a, int b); int Performsubtraction(int a, int b); int PerformMultiplication(int a, int b); int PerformDivision (int a, int b); /////// Do not edit these tines ////////1 int main() int nuen int num2; int operation; int result; 1/TODO: Scan 2 numbers from the usef, and store them in num1 and num2. //TODO: Scan an operation from the usen. The following are the possible options: 111 - Addition /. 2 - Subtraction 1. 3 = Multiplication 114= Division //TODO: Using an iflelse block, call the correct function based on the operationt. ll "result" shoutd be received by the function called in your if/else blockt / /Do not touch this line of codel printf( The result is: %d, result); int PenformAddition (int a, int b) \{ 1/TODO: "Return" the correct Additiont. Int Performsubtraction(Int a, int b) int Performsubtraction (int a, int b) \{ //TOO: "Return" the conrect Subtraction! 3 int PenformMultiplication(int a, int b) f //TODO: "Return" the correct multiplicationl 3 int. Perform0ivision (int a, int b ) /ITODO: "Return" the correct division 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