Pages

Adsense responsive

Sunday, 3 February 2013

C PROGRAM: TO CALCULATE ARITHMETIC MEAN OF N NUMBERS

CODING:
#include<stdio.h>
#include<conio.h>
void main( )
{
int n;
float a[100],i,am,sum=0;

clrscr( );
printf("Enter number of terms ");
scanf("%d",&n);
printf("Enter %d values ",n);
for(i=1;i<=n;i++)
{
 scanf("%f",&a[i]);
 sum=sum+a[i];
}
am=sum/n;
printf("\n\nArithmetic Mean = %f",am);
getch( );
}


CODING



OUTPUT

For any query or suggestion please comment below.....

2 comments:

  1. what about geometric mean....

    ReplyDelete
    Replies
    1. For that we need to calculate anti-log, which seems to be difficult. There are various methods to calculate anti-log on Internet but no one works perfectly. (not sure about their working)

      Delete