Program for Checking whether the given number is Palindrome or not

Palindrome means a number which remains same if positions of its digits is reversed i.e., 1221
#include<stdio.h>
#include<conio.h>
void main()
{
int n,digit,rev=0,num;
printf("enter the number");
scanf("%d",&num);
n=num;
do
{
digit=num%10;
rev=rev*10+digit;
num/=10;
}while(num!=0);
printf("reverse number is=%d\n",rev);
if(n==rev)
{
printf("number is palindrome");
}
else
{
printf("number is not palindrome") ;
}
getch();
}

Comments

Post a Comment

Popular posts from this blog

Program for calculating Simple Interest using the concept of Default Arguments

Program: Maximum number in three numbers in visual basic