I created it as follows, but the terminal stopped with the following conditions:
There was no error on the terminal, so I didn't even know where it was wrong.
What should I do?
By the way, it seems that the execution example should be like this.c
The cause is the
scanf() format string, and if you set
"%d", you will be able to proceed.
If you specify
"%d", you may want to leave a space after the number, but one of the many traps in
scanf() does not finish typing spaces in the format string until you enter non-blank characters after spaces like
1a will not consume the last
When the last semicolon is present, this for statement loops only this.
If you want to repeat
scanf("%d", & a[i]);, delete the semicolon at the end of the for statement.
If possible, surround it with
© 2022 OneMinuteCode. All rights reserved.