// Program
#include<stdio.h>
void main()
{
int a,n,r,d;
r=0;
clrscr();
printf("Enter any number:");
scanf("%d",&n);
while(n)
{
a=n;
while(a>0)
{
d=a%10;
r=(r*10)+d;
a=a/10;
}
if(r==n)
printf("The number is palindrome");
else
printf("The number is not palindrome");
}
getch();
}
Sample Input/Output:
Enter any number:1221
The number is palindrome
#include<stdio.h>
void main()
{
int a,n,r,d;
r=0;
clrscr();
printf("Enter any number:");
scanf("%d",&n);
while(n)
{
a=n;
while(a>0)
{
d=a%10;
r=(r*10)+d;
a=a/10;
}
if(r==n)
printf("The number is palindrome");
else
printf("The number is not palindrome");
}
getch();
}
Sample Input/Output:
Enter any number:1221
The number is palindrome
No comments:
Post a Comment