adspace


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

swap 2 numbers without using third variable?

1211


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2216


What is variable initialization and why is it important?

1394


i have a written test for microland please give me test pattern

2814


What is pointers in c with example?

1169


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1183


What is dynamic dispatch in c++?

1140


Differentiate between null and void pointers.

1259


What are pointers? What are different types of pointers?

1266


Do you know the difference between malloc() and calloc() function?

1135


What is the general form of a C program?

1100


what is ur strangth & weekness

2592


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2516


What is the difference between union and anonymous union?

1399


write a program to find out prime number using sieve case?

2176