Number is palindrome or not

#include<stdio.h>
#include<conio.h>
void main()
{
int d,n,rev=0,copy;
clrscr();
printf("Enter the number:\n");
scanf("%d",&n);
copy=n;
while(n!=0)
{
d=n%10;
rev=rev*10+d;
n=n/10;
}
if(copy==rev)
{
printf("the number is palindrome");
}
else
{
printf("the number is not a palindrome")
}
}
OUTPUT:
Enter the number:
151
the number is palindrome 
Translate »