#include<stdio.h>
#include<conio.h>
void main()
{
int num,rev=0,temp,res;
clrscr();
printf("\n\nLab : 4 Program that reverse the given number and check it for Palindrome.");
printf("\n***************************************************************************");
printf("\n\n\n\tPlease enter a number : ");
scanf("%d",&num);
temp=num;
while(temp!=0)
{
res=temp%10;
rev=rev*10+res;
temp=temp/10;
};
if(num==rev)
{
printf("\n\n\t\tGiven number %d is a Palindrome",num);
}
else
{
printf("\n\n\t\tGiven number %d is not a Palindrome",num);
};
getch();
}
我就是弄不懂while(temp!=0)
{
res=temp%10;
rev=rev*10+res;
temp=temp/10;
这是什么意思。。。有谁能解释下。。。谢了~
temp为什么要除以10?
还有res是什么啊?