C program to calculate the average of three numbers

#include< stdio.h >
#include< conio.h >
void main ()
{
          int a, b, c, S;
          float Avg;
          clrscr();
          printf("Enter three numbers:");
          scanf("%d\t %d\t %d",&a,&b,&c);
          S= a+b+c ;
         Avg=S/3.0 ;
         printf(" The average of given numbers is equal to :%f",Avg);
         getch();
}

OUTPUT :

Enter three numbers :2 5 8

The average of given numbers is equal to :5

No comments :

Post a Comment