main()
{
int n,a,b=0;
printf("please enter a number !\n");
scanf("%d",&n);
printf("the number is %d\n",n);
for(a=n;a>0;){
b=b*10+a%10;
a=a/10;
}
printf("n=%d,b=%d\n",n,b);
if(b==n){
printf("yes!!!");
}else{
printf("yes!!!");
}
}
#include "Stdio.h"
#include "Conio.h"
int main(void)
{
int i,k;
long n,m;
int digit[10];
clrscr();
puts("Please input a long number:");
scanf("%ld",&n);
m=n;k=0;
do
{
digit[k++]=m%10; /**//*保存最低位*/
m/=10; /**//*去掉最低位*/
}while(m!=0);
k--;
for(i=0;i<k;i++,k--) /**//*判断是否为回文数*/
if(digit[i]!=digit[k]) break; /**//*不相等,则不是回文数,推出循环*/
if(i<k) printf("%ld is not a huiwen number",n);
else printf("%ld is a huiwen number",n);
getch();
return 0;
}
本回答被网友采纳