简单的很,既然是回文,就先把数字转成字符串,指针p,q指向两头,
随便一个数都行
#include
#include
#include
using namespace std;
int main()
{
int num;
cout<<"input a num:"<
char numstr[128]={0};
itoa(num,numstr,10);
char* p=numstr,*q=numstr+strlen(numstr)-1;
bool flag =true;
while(p if(*p++!=*q-- ){
flag=false;
break;
}
cout<<"it is "<
}
#include
int ishuiwen(long x){
int a,b,c,d,e;
a=x/10000;
b=(x/1000)%10;
c=(x/100)%10;
d=(x/10)%10;
e=x%10;
if((a==e)&&(b==d))
return 1;
else
return 0;
}
void main(){
for(long i=10000;i<100000;i++)
if(ishuiwen(i)==1) printf("%ld\t",i);
}
#include
void main()
{
char s[5];
int i=0,flag=0;
printf("输入一个五位数");
scanf("%s",s);
for(i=0;i<=3;i++)
{
if(s[i]!=s[4-i])flag=1;
}
if(flag==0){printf("YES");}
if(flag==1){printf("NO");}
}