Home > Back-end >  C language output inverse number of a three digits
C language output inverse number of a three digits

Time:10-26

CodePudding user response:

 # include 
Int main ()
{
int a,b,c;
Int m, n;
The scanf (" % d ", & amp; M);
A=m/100;
B=(m - a * 100)/10;
C=a - m - 100 * 10 * b;
N=c * 100 * 10 + a + b;
Printf (" % d ", n);
return 0;
}

Started school version of

CodePudding user response:

You to act as a string input, reverse circulation more simple

CodePudding user response:

A=m/100;
C=m % 10;
B=m/10% 10;

CodePudding user response:

Fun
reference 3 floor response:
a=m/100;
C=m % 10;
B=m/10% 10;

Yes, this is I recently come into contact with an upgraded version of the

CodePudding user response:

Without recursive doesn't this topic

Getchar
If ch!
='0'Putchar

CodePudding user response:

reference 5 floor and 蘤 old crepe reply:
without recursive how to live up to this title

Getchar
If ch!
='0'Putchar

For, and this kind of unconventional operations, using recursive process removed

CodePudding user response:

Have done, thanks.

CodePudding user response:

Version, this problem is also purchase price, integer input int, int, ^ 2-3 ~ 2 ^ 31-1, need to consider the overflow problem,
Enter 123 output of 321
Input - 123-321
Input XXX, if reverse overflow, 0

CodePudding user response:

 # include & lt; stdio.h> 

Void reverse_num (int num);
Int main (void)
{
Reverse_num (123);
Putchar (10);
return 0;
}

Void reverse_num (int num)
{
If (num==0)
return;

Printf (" % d ", num % 10);
Reverse_num (num/10);
}

For your reference ~
  • Related