Home » Blog » To calculate the average of five numbers.

To calculate the average of five numbers.

This Program calculate the average of five numbers. This gives basic working of C Program.

#include<stdio.h>

void main()
{
    int no1,no2,no3,no4,no5,sum;
    float avg;

    printf("\n\tEnter First Number ");
    scanf("%d",&no1);

    printf("\n\tEnter Second Number ");
    scanf("%d",&no2);

    printf("\n\tEnter Third Number ");
    scanf("%d",&no3);

    printf("\n\tEnter Fourth Number ");
    scanf("%d",&no4);

    printf("\n\tEnter Fifth Number ");
    scanf("%d",&no5);

    sum=no1+no2+no3+no4+no5;
    avg=sum/5;

    printf("\n\t_____________________________________________");
    printf("\n\n\tSum Of Above Number Is %d",sum);
    printf("\n\tAverage Of Above Five Numbers Is %f\n\n",avg);
}

 

Leave a Reply

Your email address will not be published.