Write a program to find palindrom number.

Write a program to find palindrom number.

 

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int n1,n,rem,rev=0;

printf("enter a number=\n");

scanf("%d",&n);

n1=n;

while(n!=0)

{

rem=n%10;

rev=rev*10+rem;

n=n/10;

}

if(n1==rev)

{

printf("%d is a palindrom  number",n1);

}

else

{

printf("%d is not a palindrom  number",n1);

}

getch();

}

 

===========================================

 

Output:

 

enter a number=121

121 is a palindrom  number


Comments