Home > Back-end >  Bosses, help tip output transfinite oj, codeblock is normal
Bosses, help tip output transfinite oj, codeblock is normal

Time:11-07

#include
#include

Int main ()
{
Int n, I, sum;
While (the scanf (" % d ", & amp; N))
{
Sum=0;
for(i=0; n; I++)
{
Sum=sum + n % 10;
N/a=10;
}
Printf (" % d \ n ", sum);
}
return 0;
}

CodePudding user response:

The scope of the int type (integer) for - 2 ^ 31 ~ 2 ^ 31-1, namely - 2147483648 ~ 2147483647
Topic is required input number & lt; 2 ^ 32 for 2 ^ 2 ^ 31 ~ 32-1 digital program is unable to determine the matter with you

CodePudding user response:

reference 1/f, 5250 response:
int type (integer) range is 2 ^ 31 ~ 2 ^ 31-1, namely - 2147483648 ~ 2147483647
Topic is required input number & lt; 2 ^ 32 for 2 ^ 2 ^ 31 ~ 32-1 digital program is unable to determine the matter with you

Thank you, I do it,

CodePudding user response:

Try changing n to unsigned long or unsigned long long