请帮忙编程,急用,谢谢!

来源:百度知道 编辑:UC知道 时间:2024/07/07 12:44:17
若一个数(首位不为0)从左到右读与从右到左读都是一样,这个数就叫做回文数,例如12521就是一个回文数。若是回文数,输出YES,否则输出NO

用C 语言

#include <stdio.h>
#include <string.h>
int main()
{
char a[100],*p,*q;

for(p=a,q=a+strlen(a)-1;p<q&&*p==*q;p++,q--);
if(p<q)puts("NO");
else puts("YES");
return 0;
}

#include "stdio.h"
#include "conio.h"
main( )
{
long ge,shi,qian,wan,x;
scanf("%ld",&x);
wan=x/10000;
qian=x%10000/1000;
shi=x%100/10;
ge=x%10;
if(ge==wan&&shi==qian)/*个位等于万位并且十位等于千位*/
printf("this number is a huiwen\n");
else
printf("this number is not a huiwen\n");
getch();
}
我说的是五位数呀
像88 66 22 101 都没在内
都不行