CodePudding user response:
Every time before input, need to put the sum,
While (1)
{
Sum=0;
The scanf (" % d ", & amp; N);
//after the code is the same with you
}
CodePudding user response:
Wipe, write wrong, should be the Max reset
While (1)
{
Max=0;
The scanf (" % d ", & amp; N);
//after the code is the same with you
}
CodePudding user response:
In the for loop before or after the cycle of Max clear operation is no problem, if not zero, then the last calculated Max could affect to the next set of resultsCodePudding user response:
Reference:# include & lt; Math. H>
#include
# define N 50
# define M 2
Int main (int arg c, char * argv [])
{
Int I, j, h, n;
Float Max=0;
Float score [N] [M]={0}, a_space [N]={0};
Printf (" please enter the number of athletes: ");
While (1)
{
The scanf (" % d ", & amp; N);
If (n==0) break;
for(i=0; ifor(j=0; J The scanf (" % f ", & amp; Score [I] [j]);
for(i=0; i{
for(j=0; JA_space [I] +=score score [I] [j] * [I] [j];
A_space [I]=SQRT (a_space [I]);
}
Max=a_space [0].
for(i=0; i{
If (max{
Max=a_space [I];
H=I + 1;
}
}
Printf (" champion is NO. # % d, grades=% f \ n ", h, Max).
}
return 0;
}
CodePudding user response:
According to the question, the words of this definition:# define N 100
CodePudding user response: