#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,m,sum=0,a;
printf("Enter a no");
scanf("%d",&n);
//a integer number is palindrome if original number and number formed by reversing the sequence of //digits are equal
m=n;
while(n>0)
{
a=n%10;
sum=sum*10+a;
n=n/10;
}
if(sum==m)
{
printf("No is palindrome");
}
else
{
printf("No is not palindrome");
}
getch();
}
output
Enter a no 242
No is palindrome
#include<conio.h>
void main()
{
clrscr();
int n,m,sum=0,a;
printf("Enter a no");
scanf("%d",&n);
//a integer number is palindrome if original number and number formed by reversing the sequence of //digits are equal
m=n;
while(n>0)
{
a=n%10;
sum=sum*10+a;
n=n/10;
}
if(sum==m)
{
printf("No is palindrome");
}
else
{
printf("No is not palindrome");
}
getch();
}
output
Enter a no 242
No is palindrome
No comments:
Post a Comment