Why I don't have the result by return later???????
Thank you brother!
# include "stdio.h"
Float the main ()
{
Float y=0, score, sum=0, I=1;
The scanf (" % f ", & amp; Score);
While (score! )
='\ n'{
Sum=sum + score;
i=i+1;
Y=sum/I;
The scanf (" % f ", & amp; Score);
}
Printf (" the average grades of this class is: % f ", y);
}
CodePudding user response:
Score is a floating point number, how can do comparison and '\ n' characters?With each other as exit, not a good design method, passing in a lot of input function is used to determine the input
You can use 0==the scanf (" % f ", & amp; Score), when you enter is not a floating point number, the scanf returns 0, to quit
CodePudding user response:
Fun