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
swap 2 numbers without using third variable?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What is variable initialization and why is it important?
i have a written test for microland please give me test pattern
What is pointers in c with example?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
What is dynamic dispatch in c++?
Differentiate between null and void pointers.
What are pointers? What are different types of pointers?
Do you know the difference between malloc() and calloc() function?
What is the general form of a C program?
what is ur strangth & weekness
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is the difference between union and anonymous union?
write a program to find out prime number using sieve case?