Question: Problem 4 Write a C program, called calculator.c, that does the following. The program should prompt the user to enter two positive integers x and

 Problem 4 Write a C program, called calculator.c, that does the

Problem 4 Write a C program, called calculator.c, that does the following. The program should prompt the user to enter two positive integers x and y, read these integers, and then output the following values: x+y, x,y, x/y, x% y where x % y denotes the remainder obtained when x is divided by y. The prograrn should also explain for the user the values that it outputs. Notice that the ratio x/y should be computed using integer di- vision in C; thus this ratio is truncated if y does not divide x exactly. Finally, observe that in order to 3 print the character & to the screen, you should include 8t if the format string of the printf function. Here is a sample run of such a program, assuming that the executable file is called calculator home/userxYz/ECE15/Lab0> calculator Enter x: 20 Enter y: 6 Here are the results: x+y = 26 x*y = 120 x/y = 3 x%y = 2

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!