#include<stdio.h>
void main() /*main function*/
{
float mavg=0, favg=0;
int mh[5], fh[5], count;
float mtot, ftot;
for(count=0;count<5;count++) /*for loop*/
{
printf("\nEnter the height of %d",count+1);
printf("male");
scanf("%d",&mh[count]);
mtot+=mh[count];
}
mavg=mtot/5;
printf("\n");
for(count=0;count<5;count++) /*for loop*/
{
printf("\n\nEnter the height of %d",count+1);
printf("female");
scanf("%d",&fh[count]);
ftot+=fh[count];
}
favg+=ftot/5; /*Formula to find average*/
printf("\nThe average male height is %f",mavg);
printf("\nThe average female height is %f",favg);
}
No comments:
Post a Comment