Hey guys!
I'm trying to calculate the average for student marks using pretest loop, and for some reason i get the wrong result, even though the code looks proper to me.,
there are 7 questions all of them totaling 100%, i haveto return average mark
i HAVETO use pretest loop.
Any help would be greatly appreciated!!
here comes the code! Thanx
{
double stdmark;
int i;
int total=0;
int average;
for(i=1;i<=7;i++)
{
// printf("\n");
printf("Enter Mark#%d:",i);
scanf("%lf", &stdmark);
total=total+stdmark;
}
average=total/i;
return average;
}