Vision and dreams are the blueprints of soul and achievements.
-Mohammed Ahmed F

Average of numbers

#include<stdio.h>
#iclude<conio.h>
void main()
{
    int i,n;
    float x,sum=0;avg;
    clrscr();
    printf("\nHow many numbers\n");
    scanf("%d",&n);
    for(i=0;i<=n;i++)
    {
        printf("\n Enter a number\n");
        scanf("%f",&x);
        sum+=x;
    }
    avg=sum/n;
    printf("\n The average =%f",avg);
    getch();
}

Output:

How many numbers
4
Enter a number
1 4 3 4
The average =3

Share this

Related Posts

Dear User,

Thank you for your comment. Hope you like this blog. Kindly share us on Social Media so others can be updated.

-Chief Administrative Officer.