Program to check given number is palendrome or not in C
#include
#include
main()
{
int n,x;
printf("Enter a number:");
scanf("%d",&n);
x=palendrome(n);
if(x==n)
printf("Palendrome ");
else
printf("Not palendrome ");
}
int palendrome(int num)
{
int r=0;
while(num>0)
{
r=r* 10 + num%10;
num=num/10;
}
return r;
}
#include
main()
{
int n,x;
printf("Enter a number:");
scanf("%d",&n);
x=palendrome(n);
if(x==n)
printf("Palendrome ");
else
printf("Not palendrome ");
}
int palendrome(int num)
{
int r=0;
while(num>0)
{
r=r* 10 + num%10;
num=num/10;
}
return r;
}
No comments
Post a Comment