write a recursive program in'c'to find whether a given five
digit number is a palindrome or not

Answer Posted / nikhil kumar saraf

void main()
{
int no,n,r=0,sum,a,c;
clrscr();
printf("Enter the number:-");
scanf("%d",&no);
n=no;
c=0;
while(n!=0)
{
n=n/10;
c++;
}
if(c!=5)
{
printf("The given number is not a five digit no.");
break;
}
else
{
n=no;
while(n!=0)
{
a=n%10;
r=(r*10)+a;
n=n/10;
}
if(r==no)
printf("The given no. is a pallidrom no.");
else
printf("The given no. is not pallidrom no.");
}
getch();
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you divide two numbers in a MACRO?

715


What is #include stdio h?

689


Do pointers take up memory?

662


What are the 32 keywords in c?

639


Here is a neat trick for checking whether two strings are equal

567






What are integer variable, floating-point variable and character variable?

611


Can you tell me how to check whether a linked list is circular?

776


What do mean by network ?

661


How do you print an address?

750


How can type-insensitive macros be created?

704


Tell us something about keyword 'auto'.

668


What is actual argument?

593


What is cohesion in c?

545


What is a lookup table in c?

629


What is difference between stdio h and conio h?

890