#include <stdio.h>
#include <stdlib.h>
#define true 1
#define false 0
int InvertSequence(int m)
{
int c,d,e=0;
if (m > 0 && m < 10)
printf("%d", m);
else if (m >= 10 && m <= 99)
{
c= m / 10;
d = m - 10 * c;
printf("%d%d", d, c);
}
else if (m >= 100 && m < 1000)
{
c= m / 100;
d= (m - 100 * c) / 10;
e= m - 100 * c - 10 * d;
printf("%d%d%d", e,d , c);
}
}
int loop(int x)
{
if (x == InvertSequence(x))
return true;
else
return false;
}
int main()
{
int a=0;
int i = 0;
int b = 0;
int p, q = 0;
scanf("%d%d", a, b);
for (i = a; i <= b; i++)
{
p = InvertSequence(i);
q = loop(p);
if (q == true)
{
printf("%d\n", p);
}
}
system("pause");
}
uj5u.com熱心網友回復:
int InvertSequence(int m)沒有回傳值轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/269976.html
標籤:C語言
