Question: Write and run a C program that 1. Simulate a simple calculator. It reads two integers and a character from user. If the character is

Write and run a C program that1.

Simulate a simple calculator. It reads two integers and a character from user. If the character is a + , the sum is printed; if it is a - , the

difference is printed; if it is a * , the product is printed; if it is a / , the quotient is printed; and if it is a % , the remainder is printed.

i wrote this code but it is giving me erorr

 Write and run a C program that1. Simulate a simple calculator.

include int main () int a,b; char C printf ("Enter first integer second integer") scanf ("%d %d", &a, &b) ; printf ("enter character"); scanf ("%c", &d); sum=a+b; %f ", sum) ; printf ("sum is if(c== '-') int diff-a-b of %d and %d is:%d ", a,b, diff); printf ("difference else if (c=' * ' ) int mul=a*b; of %d and %d is: %d ", a,b,mul); printf ("Multiplication else if (c=-'/') int div =a/b; of %d and %d is:%d ", a,b, div); printf ("division else if ( ' % ') int rem=a%b; printf ("remainder of %d and %d is:%d ", a,b, rem); else printf ("Invalid input. ") return 0

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!