Wednesday, 16 September 2015

C PROGRAMMING-- PALINDROME

#include<stdio.h>
#include<conio.h>
void main()
{       clrscr();
int n,r,rev=0,n1;
printf("enter the no.=\n");
scanf("\n%d",&n);
n1=n;
while(n>0)
{ r=n%10;
n=n/10;
rev=rev*10+r;}

printf("reverse=%d\n\n",rev);
if(n1==rev)
{ printf("\nPALLINDROME!!!");
}
else
{ printf("\nOOPS!!! NOT PALLINDROME");
}
getch();
}

No comments:

Post a Comment