9 Jan 2015

Program: A given number is palindrom or not



#include<stdio.h>
#include<conio.h>
void main()
{
int  n,r,n1,rev=0;
clrscr();
printf("Enter the any given no:\n");
scanf("%d",&n);
n1=n;
while(n>0)
{
r=n%10;
rev=(rev*10)+r;
n=n/10;
}
if(n1==rev)
printf("The given number is palindrom\n");
else
printf("The given number is not palindrom\n ");
getch();
}

No comments:

Post a Comment