Have a Read!

Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!

Thursday, January 27, 2011

C PROGRAM FOR 5 NUMBERS AVERAGE TELLER

#include<stdio.h>
int main ()
{
float a,b,c,d,e,sum,avg;
printf("ENTER THE FIVE NUNBERS\n");
scanf("%f%f%f%f%f",&a,&b,&c,&d,&e);
sum=a+b+c+d+e;
avg=sum/5;
printf("SUM=%.2f\n",sum); // .2 is used to restrict upto 2 decimal digit
printf("AVERAGE=%.2f\n,",avg);
return 0;
}

2 comments:

Related Posts with Thumbnails