28/11/2008, 12:58
#include<stdio.h>
#include<conio.h>
float avr_age();
float avr_weight();
float avr_height ();
int main ()
{ float a,b,c;
a=avr_age();
printf("The average of age of 10 students' is ==> %f\n",a);
b=avr_weight();
printf("The average of weight of 10 students' is ==> %f\n",b);
c=avr_height();
printf("The average of height of 10 students' is ==> %f\n",c);
getch ();
return 0;
}
float avr_age(void){
int age[10],i,sum=0;
float result;
printf("Pls enter age of students:\n");
for(i=0;i<10;i++){
printf("Enter the %d th student's age==",(i+1));
scanf("%d",&age[i]);
sum+=age[i];
}
result=(float)sum/10;
return result;
}
float avr_weight(void){
float weight[10],result;
int i,sum=0;
printf("Pls enter weight of students:\n");
for(i=0;i<10;i++){
printf("Enter the %d th student's weight==",(i+1));
scanf("%f",&weight[i]);
sum+=weight[i];
}
result= (float)sum/10;
return result;
}
float avr_height(void){
float height[10],result;
int i,sum=0;
printf("Pls enter height of students:\n");
for(i=0;i<10;i++){
printf("Enter the %d th student's height==",(i+1));
scanf("%f",&height[i]);
sum+=height[i];
}
result= (float)sum/10;
return result;
}
#include<conio.h>
float avr_age();
float avr_weight();
float avr_height ();
int main ()
{ float a,b,c;
a=avr_age();
printf("The average of age of 10 students' is ==> %f\n",a);
b=avr_weight();
printf("The average of weight of 10 students' is ==> %f\n",b);
c=avr_height();
printf("The average of height of 10 students' is ==> %f\n",c);
getch ();
return 0;
}
float avr_age(void){
int age[10],i,sum=0;
float result;
printf("Pls enter age of students:\n");
for(i=0;i<10;i++){
printf("Enter the %d th student's age==",(i+1));
scanf("%d",&age[i]);
sum+=age[i];
}
result=(float)sum/10;
return result;
}
float avr_weight(void){
float weight[10],result;
int i,sum=0;
printf("Pls enter weight of students:\n");
for(i=0;i<10;i++){
printf("Enter the %d th student's weight==",(i+1));
scanf("%f",&weight[i]);
sum+=weight[i];
}
result= (float)sum/10;
return result;
}
float avr_height(void){
float height[10],result;
int i,sum=0;
printf("Pls enter height of students:\n");
for(i=0;i<10;i++){
printf("Enter the %d th student's height==",(i+1));
scanf("%f",&height[i]);
sum+=height[i];
}
result= (float)sum/10;
return result;
}