Average of the number

 

// average of the number

#include<stdio.h>

int main()

{

    int i,n,x;

    float avg,sum=0;

    printf("enter the value which you want to take for the average:");

    scanf("%d",&n);

   

    for(i=1;i<=n;i++)

    {

        printf("x=");

        scanf("%d",&x);

        sum +=x;

    }

    

        avg=sum/n;

        printf("%f",avg);

    }


Comments

Popular posts from this blog

Use of function in mathematics

My resume using HTML and CSS