Shopping In MUMBAI

Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top. Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.

Wednesday, December 31, 2008

C program to find the arithmetic mean of n numbers

Write a function to find the arithmetic mean of n numbers. (pass an array
to a function).
Function prototype : float amean(flaot x[], int n)

#include
#include
void main()
{
float a[30],am;
int n,i,j;
float amean(float [],int);
clrscr();
printf("How Many Numbers For Arithmetic Mean==");
scanf("%d",&n);
printf("\nEnter %d Numbers\n",n);
for(i=0;i scanf("%f",&a[i]);
am=amean(a,n);
printf("\nArithmetic Mean of %d Numbers==%f",n,am);
getch();
}
float amean(float *a,int n)
{
float am=0;
int i;
for(i=0;i {
am=am+*(a+i);
}
am=am/n;
return am;
}
/* Output
How Many Numbers For Arithmetic Mean==6

Enter 6 Numbers
1
3
6
5
12
23

Arithmetic Mean of 6 Numbers==8.333333
*/

C program to find the arithmetic mean of n numbersSocialTwist Tell-a-Friend

0 comments:

SUPPORT THIS BLOG