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
can we implement multi-threads in c.
Why we use int main and void main?
Is c procedural or functional?
What does *p++ do? What does it point to?
What do you mean by keywords in c?
What do you mean by recursion in c?
how do you execute a c program in unix.
which is an algorithm for sorting in a growing Lexicographic order
What is extern variable in c with example?
What is the best way to comment out a section of code that contains comments?
code for replace tabs with equivalent number of blanks
What is the explanation for modular programming?
What is #include stdio h and #include conio h?
How will you write a code for accessing the length of an array without assigning it to another variable?
What is hash table in c?