# define N 10
Int main ()
{
Int s [N], temp;
Int I, j, pos, CNT=0;
Float passed;
for (i=0; I & lt; N; I++)
{
Scanf_s (" % d ", & amp; S [I]);
If (s [I] & gt;=60)
Cnt++;
}
Passed=(double) (CNT/N);
for (i=0; I & lt; N - 1; I++)
{
For (pos=0; Pos & lt; N - I - 1; Pos++)
{
If (s/pos & lt; S [pos + 1])
Temp=s [pos + 1];
S [pos + 1)=s (pos);
S (pos)=temp;
}
}
If (passed & lt; 0.7)
{
for (i=0; I & lt; N; I++)
{
If (s [I] <60 & amp; & Passed<0.7)
{
S [I]=60;
Cnt++;
Passed=(double) (CNT/N);
}
}
}
for (i=0; I & lt; N; I++)
{
Printf (" % d ", s [I]);
}
return 0;
}
CodePudding user response:
Passed=(double) (CNT/N);Should be changed to
Passed=((double) CNT)/N
That calculate,
CodePudding user response:
If (s/pos & lt; S [pos + 1])Temp=s [pos + 1];
S [pos + 1)=s (pos);
S (pos)=temp;
This paragraph sort if statement less braces
If (s/pos & lt; S [pos + 1])
{
Temp=s [pos + 1];
S [pos + 1)=s (pos);
S (pos)=temp;
}
CodePudding user response:
Passed=CNT * 1.0/N; It also can be realizedCodePudding user response:
Heard that scores of the university of processing methods:(Score prescribing) * 10