Time:10-20
CodePudding user response:
long int the maximum is 2147483647
Quote: refer to 1st floor? Victor.?? Response: long int the maximum is 2147483647 Why always output after I use the long long 12 digits, and you only and don't correct
Quote: refer to the second floor m0_46379100 response: The Quote: 1 reference building? Victor.?? Response: long int the maximum is 2147483647 Why always output after I use the long long 12 digits, and you only and don't correct You put the source code, I try
The Quote: 1 reference building? Victor.?? Response: long int the maximum is 2147483647 Why always output after I use the long long 12 digits, and you only and don't correct
# include & lt; stdio.h> Int main () {Int sum=0; int count=0; Long long int num. Printf (" please enter a number: "); The scanf (" % LLD, & amp; Num); Do {If (num<0) {Printf (" please enter a number greater than 0: "); The scanf (" % LLD, & amp; Num); } } while (num<0); While (num!=0) {The sum +=num % 10; Num/=10; count++; } Printf (" digit % d, the sum of the number of you is % d, \ n ", count, sum); }
try this # include & lt; stdio.h> Int main () {Int sum=0; int count=0; Long long int num. Printf (" please enter a number: "); The scanf (" % LLD, & amp; Num); Do {If (num<0) {Printf (" please enter a number greater than 0: "); The scanf (" % LLD, & amp; Num); } } while (num<0); While (num!=0) {The sum +=num % 10; Num/=10; count++; } Printf (" digit % d, the sum of the number of you is % d, \ n ", count, sum); } What is % l64d operation
# include & lt; stdio.h> #include #include Int main (void) {Char STR [32]. Int ret, len, sum=0, I; Printf (" please enter a number: "); Ret=the scanf (" % s ", STR); While (ret & amp; & STR [0]=='-') {Printf (" please enter a number greater than 0: "); Ret=the scanf (" % s ", STR); } Do {Len=strlen (STR); i=0; While (STR) [I] {The sum +=STR [i++] - '0'; } If (sum==0) {Printf (" please enter a number greater than 0: "); Ret=the scanf (" % s ", STR); } } while (sum==0); : printf (" % d, the sum of the number of you is % d \ n ", len, sum); return 0; }
Page link:https//www.codepudding.com/Backend/69092.html