Int main (void)
{
Long num.
Long sum=0 l;
Int the status;
Printf (" both Please enter an integer to be summed ");
Printf (" (q to quit) : ");
Status=the scanf (" % ld ", & amp; Num);
While (status==1)
{
Sum=sum + num;
Printf (" do enter next integer (q to quit) : ");
Status=the scanf (" % ld ", & amp; Num);
}
Printf (" Those integers sum to % ld. \ n ", sum);
getchar();
return 1;
}
CodePudding user response:
Append a more getcharOr getchar into the system (" pause ");
CodePudding user response:
Flash back because of the building after the last input and a newline character in the input buffer, thus getchar (); Just received '\ n', so they returned, namely the flash back,Can consider according to the above method, add a getchar (); Or it in the system (" pause "); Try ~
CodePudding user response:
Problem has been solved, we'll need to add two getchar ()