Home > Back-end >  Pray god to help
Pray god to help

Time:09-26

# include & lt; stdio.h>

Int main ()
{
Int I, j, a [11], min, temp.
for(i=1; i<=10; I++)
The scanf (" % d ", & amp; A [I]);
for(i=1; i<10; I++)
{
For (j=I + 1; j<=10; J++)
If (a [I] & gt; A [j])
Temp=a, [I].
A [I]=a, [j].
A [j]=temp;
}
for(i=1; i<=10; I++)
Printf (" % d ", a [I]);
printf("\n");
Return (0);
}

Why can't I this code will be ordered number

CodePudding user response:

If (a [I] & gt; A [j])
At the back of the exchange operation to use {}

CodePudding user response:

For (j=I + 1; j<=10; J++)
If (a [I] & gt; A [j])
Temp=a, [I].
A [I]=a, [j].
A [j]=temp;


The FOR loop using parentheses after remembered

CodePudding user response:

If statements just to the first semicolon, code with big parentheses tube to the code block
  • Related