Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Wednesday, 20 February 2013

C PROGRAM: TO CALCULATE ARITHMETIC MEAN OF N TERMS USING POINTER

CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
float a[100],i,am,sum=0,*p;
p=&a;
clrscr();
printf("Enter number of terms ");
scanf("%d",&n);
printf("Enter %d values ",n);
for(i=0;i<n;i++)
{
 scanf("%f",&a[i]);
 sum=sum+*p;
 p++;
}
am=sum/n;
printf("\n\nArithematic Mean = %f",am);
getch();
}


CODING

OUTPUT

For any query or suggestion please comment below...

No comments:

Post a Comment