Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

Additional Factors Affecting Group Communication?

Answered: 1 week ago