Home > Back-end >  Give a positive integer, not more than five and a few digits, the output is a digital
Give a positive integer, not more than five and a few digits, the output is a digital

Time:09-19

# include
Int main ()
{
Int a, b, c, d, e;
The scanf (" % d, & amp; N ");
If (n> 9999)
P=5;
Else if (n> 999)
P=4;
Else if (n> 99)
P=3;
Else if (n> 9)
P=2;
The else p=1;
Printf (" digits: % d \ n ", p);
Printf (" digit is: ");
}
Int main

Intn, a, b, c, d, e;
The scanf (" % d, & amp; N ");
A=n/10000;
B=n/1000% 10;
C=n/100% 10;
D=n/10% 10;
E=n/10;
Printf (" % d % d % d % d % d \ n ", a, b, c, d, e);
Printf (" % d % d % d % d % d \ n ", e, d, c, b, a);
return 0;
}

CodePudding user response:

You this algorithm generality is bad, with a loop (n!=0) :
N % 10 single digits, output, a few digits of variable + +
N=10/get rid of the single digits

CodePudding user response:

Note that n is 0,
  • Related