# Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005

By | June 12, 2014

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005

#include<stdio.h>
int flag=0;
void palin(int,int*);
void main()
{
int a;
clrscr();
printf(“Enter the number “);
scanf(“%d”,&a);
palin(a,&a);
if(flag==0)
printf(“\nThe number is palindrome…”);
else
printf(“\nThe number is not palindrome…”);
getch();
}

void palin(int x,int* y)
{
int a,b;
if(x%10==0&&x/10==0)
return;
else
{
a=x%10;
palin(x/10,y);
b=*y%10;
*y=*y/10;
if(a!=b) flag=1;
}
}

 Source code
```#include<stdio.h>
int flag=0;
void palin(int,int*);
void main()
{
int a;
clrscr();
printf("Enter the number ");
scanf("%d",&a);
palin(a,&a);
if(flag==0)
printf("\nThe number is palindrome...");
else
printf("\nThe number is not palindrome...");
getch();
}
void palin(int x,int* y)
{
int a,b;
if(x%10==0&&x/10==0)
return;
else
{
a=x%10;
palin(x/10,y);
b=*y%10;
*y=*y/10;
if(a!=b) flag=1;
}
}```

Screen Shots:-