>


Mean Method in C

The mean is the average of the numbers: a calculated "central" value of a set of numbers. To calculate: Just add up all the numbers, then divide by how many numbers there are.

Program of Mean in C


  #include<stdio.h>
  #include<conio.h>
  #include<math.h>
  
  void main()
  {
     int s=0,mean,n,i,a[50];
     clrscr();
     printf("Enter the Frequency :- ");
     scanf("%d",&n);
     printf("Enter %d Values of n :- ",n);
     for(i=0; i<n; i++)
     {
       scanf("%d",&a[i]);
     }
     for(i=0; i<n; i++)
     {
       s=s+a[i];
     }
     mean=s/n;
     printf("Mean is = %d",mean);
     getch();
   }

Output

mean method

Post Your Comment