发布网友 发布时间:2022-07-18 17:23
共3个回答
热心网友 时间:2023-10-11 22:53
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!!!");
}
}
热心网友 时间:2023-10-11 22:53
#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;
}
热心网友 时间:2023-10-11 22:54
# include <stdio.h>