#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;
}
#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;
}