#include<stdio.h>
#include<conio.h>
void main()
{
long n, r, ri=0, oi;
clrscr();
printf("\nEnter a number: ");
scanf("%ld",&n);
oi = n;
while(oi!=0)
{
ri = ri * 10;
ri = ri + oi % 10;
oi = oi / 10;
}
if(n==ri)
{
printf("\nThe given number is a Palindrome");
}
else
{
printf("\nThe given number is not a palindrome");
}
getch();
}
Output:
Enter a number: 1221
The given number is a Palindrome
Output:
Enter a number: 953212359
The given number is a Palindrome
#include<conio.h>
void main()
{
long n, r, ri=0, oi;
clrscr();
printf("\nEnter a number: ");
scanf("%ld",&n);
oi = n;
while(oi!=0)
{
ri = ri * 10;
ri = ri + oi % 10;
oi = oi / 10;
}
if(n==ri)
{
printf("\nThe given number is a Palindrome");
}
else
{
printf("\nThe given number is not a palindrome");
}
getch();
}
Output:
Enter a number: 1221
The given number is a Palindrome
Output:
Enter a number: 953212359
The given number is a Palindrome
Comments
Post a Comment