Question: Write a program in C to implement calculator using pointers. You should ask the user two operands and what kind of arithmetic operation the user

Write a program in C to implement calculator using pointers.

You should ask the user two operands and what kind of arithmetic operation the user wants to run on them. This shouldnt be just a onetime operation, the user should be able to input the operands and the kind of operation which it wants to be performed on them as long as he wants to. Users may enter Q to quit the program. You need to write separate function for all the operations (+, -, *, /). In these functions you need to pass the variables as pointers and then perform the requested operation and return the result. To calculate the result, you should not use a third variable. For example: Consider the function int sum(int *a, int *b); Here, the addition of two numbers must be stored in a and returned.

Sample run: Enter the operation you want to perform(+ for Addition,- for Subtraction,* for Multiplication, / for Division, Q to quit): +

Enter the operands for this operation :7, 8

Your output: 15

Enter the operation you want to perform(+ for Addition,- for Subtraction,* for Multiplication, / for Division, Q to quit): -

Enter the operands for this operation: 109, 9 Your output: 100 Enter the operation you want to perform(+ for Addition,- for Subtraction,* for Multiplication, / for Division, Q to quit):Q

Goodbye!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!