Search This Blog

Translate

C program to calculate sum and average of five number

C program to calculate sum and average of five number

void main()
{
    int a,b,c,d,e,ans; float avg;
    clrscr();
    printf("\nEnter first number=");
    scanf("%d",&a);
    printf("\nEnter second number=");
    scanf("%d",&b);
    printf("\nEnter third number=");
    scanf("%d",&c);
    printf("\nEnter fourth number=");
    scanf("%d",&d);
    printf("\nEnter fifth number=");
    scanf("%d",&e);
    printf("\n\n*********** Result **********");
    ans=a+b+c+d+e;
    printf("\n\nThe sum of entered number is= %d",ans);
    avg=ans/5;
    printf("\n\nThe average of entered number is= %.2f",avg);
    getch();
}


C program to calculate sum and average of five number

C Program example List

Google+ Badge