Sunday, March 24, 2013

Sum, Product, and Average Calculator - C Language

TASK:
Write a program that takes four floating numbers as input from the user and prints their sum, product, and average. 

INPUT:
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
float a,b,c,d,e,f,g;
printf("                            Sum, Product, and Average");
printf("\n\nInsert the 1st value:");
scanf("%f", &a);
printf("Insert the 2nd value:");
scanf("%f", &b);
printf("Insert the 3rd value:");
scanf("%f", &c);
printf("Insert the 4th value:");
scanf("%f", &d);
e=a+b+c+d;
printf("\nYour sum is:%f", e);
f=a*b*c*d;
printf("\nYour product is:%f", f);
g=e/4;
printf("\nYour average is:%f", g);
getche();
}

OUTPUT:

No comments:

Post a Comment