Wednesday, 29 July 2015

Write a C program to check whether the given number is palindrome or not

#include <stdio.h>
#include <conio.h>

void main()
{
int b,r,n,s=0;
scanf("%d",&n);
b=n;
while(n!=0)
{
r=n%10;
s=s*10 + r;
n/=10;
}
if(s==b)
printf("\n The number is palindrome");
else
printf("\n The number is not palindrome");
getch();
}

No comments:

Post a Comment