Home > Back-end >  The small white asked you a few questions
The small white asked you a few questions

Time:10-31

1,
#include

Int main ()
{
Int I, n;
Printf (" please input is an integer n, and n, respectively, in two lines of a positive integer: ");
The scanf (" % d \ n ", & amp; N);

Int the number [n - 1);


for(i=0; i{
The scanf (" % d ", & amp; The number [I]);
}
The scanf (" % d ", & amp; Number (n - 1));

For (int I=n - 1; I>=0; I -)
{
Printf (" % d ", the number [I]);
}


return 0;
}

This is an array with the output sequence of program, input like this:
5
1, 2, 2, 4, 5
After the output 5 4 2 2 1

But I change the first for loop became:
for(i=0; i<=n - 1; I++)
{
The scanf (" % d ", & amp; The number [I]);
}

Input:
5
1, 2, 2, 4, 5, output will not reverse order when instead to return again and add an arbitrary number like this:

5
1, 2, 2, 4, 5
5
When will output:
5 4 2 2 1

This is why, really do not understand, feeling is that the same two for loop
  • Related