用c语言编译一程序,判断一个不超过十位的数是否是回文数,尽量从初学者的角度回答,用循环结构,谢谢了!
来源:百度知道 编辑:UC知道 时间:2024/06/03 13:31:00
#include <stdio.h>
void fun(char* p)
{
char *s=p;
while(*s!='\0')
s++;
s--;//指针移动到字符串末尾
for(;s>p;p++,s--)
{
if(*s==*p);
else
{
printf("is not the 回文 number\n");
return;
}
}
printf("the number is 回文 \n");
}
void main()
{
char c[11];
printf("input 10 numbers\n");
scanf("%s",c);
fun(c);
}
有问题发消息!