Project #5 Due 11/05/2013 extended due date: 10/23/2012 by 5:00 pm 1. Write an i
ID: 3545447 • Letter: P
Question
Project #5
Due 11/05/2013
extended due date: 10/23/2012 by 5:00 pm
1. Write an interactive program to prompt and read two float typenumbers, Then your program should perform and print the following arithmatics:(use FOR loop structure to repeat program 3 times.
1) Sum
2)Difference
3) Product
4) Quotient
5) Modulus (use system defined fmod function)
You must use system's defined function prototype and/or to createprogrammer's defined function prototype for each of the above calculation. Inaddition, create a function called "DISPLAYADD " using loopingconcept and a single print statement to create a line of Add(+) signs.
The following is the output:
++++++++++++++++++++++++++++++++++
Enter first number : 23
Enter second number : 12
Two numbers you have entered are 23 and 12
The sum is 35
The difference is 11
The product is 276
The quotient is 1.92
The remainder is 11
++++++++++++++++++++++++++++++++++
Enter first number : 24.00
Explanation / Answer
#include<stdio.h>
void DISPLAYADD()
{
int i;
for(i=0;i<3;i++)
{
printf("++++++++++++++++++++++++++++++++++ ");
float m,n;
printf("Enter first number :");
scanf("%f",&m);
printf("Enter second number :");
scanf("%f",&n);
printf("Two numbers you have entered are %f and %f ",m,n);
printf("The sum is %f ",m+n);
printf("The difference is %f ",m-n);
printf("The product is %f ",m*n);
printf("The quotient is %.2f ",m/n);
printf("The remainder is %.2f ",m%n);
}
int main()
{
DISPLAYADD();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.