Home > Back-end >  Reverse application reads one is three digits at a time, and then output the number of reverse order
Reverse application reads one is three digits at a time, and then output the number of reverse order

Time:09-27

#include
Int main ()
{
Int a, b, c, d, e;

The scanf (" % d ", & amp; a);
B=a/100;
E=a % 100;
C=e/10;
D=a % 10;
If (c> 0 & amp; & b> 0)
{
Printf (" % d % d % d \ n ", d, c, b);
}
The else
{
Printf (" % d \ n ", d);
}

return 0;
}

CodePudding user response:

B, c only 1 didn't consider the condition of zero, such as the 405

CodePudding user response:

Can you help me change the,,,, not me

CodePudding user response:

Two methods of
 
Int main ()
{
Int a, b, c, d, e;
The scanf (" % d ", & amp; a);
////comment out code can not limit number of size, the y value after the reverse order of numerical
//int x, y=0;
{//while (a)
//x=a % 10;
//y=y * 10 + x;
//a/=10;
//}
B=a/100;//one hundred
C=a % 100/10;//10
D=a % 10;//you
Printf (" % d \ n ", d * 100 * 10 + c + b);

return 0;
}

CodePudding user response:

 # include 

Int reverse_order_num (int num);

Int main ()
{
Int a, b, c, d, e;

The scanf (" % d ", & amp; a);
# if 0
B=a/100;
E=a % 100;
C=e/10;
D=a % 10;
If (c> 0 & amp; & b> 0)
{
Printf (" % d % d % d \ n ", d, c, b);
}
The else
{
Printf (" % d \ n ", d);
}
# endif
Printf (" % d \ n ", reverse_order_num (a));
return 0;
}

Int reverse_order_num (int num)
{
Int TMP=0;

While (num) {
TMP TMP * 10 + num=% 10;
Num/=10;
}

return tmp;
}

For your reference!

Data meet less than 2 ^ 31-1

CodePudding user response:

#include
Int main ()
{
Int a, b, c, d, e;

The scanf (" % d ", & amp; a);
B=a/100;
E=a % 100;
C=e/10;
D=a % 10;
If (c> 0 & amp; & D> 0)
{
Printf (" % d % d % d \ n ", d, c, b);
}
If (c> 0 & amp; & D==0)
{
Printf (" % d % d \ n ", c, b);
}
If (c==0 & amp; & D==0)
{
Printf (" % d \ n ", b);
}

return 0;
}
I have modified the code of the building Lord, measurement is feasible
  • Related