Int main () {
Int I;
Int a []=,1,2,3,4,5,6,7,8,9,10 {0};
Int number;
The scanf (" % d ", & amp; Number);
for(i=0; i
Printf (" % d ", a [I]);
}
return 0;
}
//could you tell me what causes
CodePudding user response:
The scanf (" % d \ n ", & amp; Number); Try thisCodePudding user response:
After you input the figures to be input by a carriage return confirmation, enter also will calculate to you input characters, such as 5 do you want to input, the actual input is 5 \ n, after they finish the scanf read 5 \ n also in buffer,CodePudding user response:
# include & lt; stdio.h>
Int main ()
{
Int I;
Int a []=,1,2,3,4,5,6,7,8,9,10 {0};
Int number;
The scanf (" % d ", & amp; Number);
If (number & gt; Sizeof (a)/sizeof (a [0]))
Number=sizeof (a)/sizeof (a [0]);
for(i=0; iThe scanf (" % d ", & amp; A [I]);
Printf (" % d ", a [I]);
}
return 0;
}
For your reference ~
Code basically no problem, pay attention to the number of input values, if enter 0, then is not into circulation, of course also cannot input is greater than the sizeof (a)/sizeof (a [0]) value, because can lead to an array,
CodePudding user response: