Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago