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
what is a constant pointer in C
Calculate 1*2*3*____*n using recursive function??
What are control structures? What are the different types?
What does the && operator do in a program code?
What does 3 mean in texting?
What is a good way to implement complex numbers in c?
Explain what is meant by high-order and low-order bytes?
What does #pragma once mean?
why programs in c are running with out #include
Explain what are preprocessor directives?
What is the use of ?: Operator?
Explain why C language is procedural?
Explain how do you print an address?
What will be your course of action for a push operation?
What are the advantages of using new operator as compared to the function malloc ()?