编程实现对任意一个3位正整数,判断它是不是

编程实现对任意一个3位正整数,判断它是不是回文数。所谓回文数是指其各位数字左右对称的正整数。例如121,个位与百位相同。

 

#include<stdio.h>
void main()
{ int a,b,c;
scanf(“%d”,&a);
if((a<100)||(a>=1000)) printf(“Input error!”);
else
{
b=a%10; c=a/100;
if(b==c) printf(“It\’s a palindrome number.”);
else printf(“It is not a palindrome number.”);
}
getch();
}

© 版权声明
THE END
喜欢就支持以下吧
点赞0 分享
There's only one corner of the universe you can be sure of improving, and that's your own self.
这个宇宙中只有一个角落你肯定可以改进,那就是你自己
评论 抢沙发

请登录后发表评论

    暂无评论内容