#include<stdio.h>
int rev(int);
void pali(int);
void main()
{
int a;
printf("\n enter a number");
scanf("%d",&a);
pali(a);
}
void pali(int x)
{
int dup;
dup=x;
x=rev(x);
if(dup==x)
printf("\n number is palindrome");
else
printf("\n number isn't palindrome");
}
int rev(int y)
{
int rem,rev;
rem=0;rev=0;
while(y>0)
{
rem=y%10;
rev=rev*10+rem;
y=y/10;
}
return(rev);
}
int rev(int);
void pali(int);
void main()
{
int a;
printf("\n enter a number");
scanf("%d",&a);
pali(a);
}
void pali(int x)
{
int dup;
dup=x;
x=rev(x);
if(dup==x)
printf("\n number is palindrome");
else
printf("\n number isn't palindrome");
}
int rev(int y)
{
int rem,rev;
rem=0;rev=0;
while(y>0)
{
rem=y%10;
rev=rev*10+rem;
y=y/10;
}
return(rev);
}
No comments:
Post a Comment