Wednesday, 29 October 2014

Given number is a pallindrome or not


Given number is a pallindrome or not




/*WAP to check whether the given number is a pallindrome or not*/

#include<stdio.h>
#include<conio.h>
void main()
{
int n,d,r=0,m;
clrscr();
printf("enter the number:");
scanf("%d",&n);
m=n;
while(n>0)
{
d=n%10;
r=r*10+d;
n=n/10;
}
if(m==r)
printf("%d is a pallindrome number",m);
else
printf("%d is not a pallindrome number",m);
getch();
}

OUTPUT:
enter the number:534

534 is not a pallindrome number

No comments:

Post a Comment