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
How will you divide two numbers in a MACRO?
What is #include stdio h?
Do pointers take up memory?
What are the 32 keywords in c?
Here is a neat trick for checking whether two strings are equal
What are integer variable, floating-point variable and character variable?
Can you tell me how to check whether a linked list is circular?
What do mean by network ?
How do you print an address?
How can type-insensitive macros be created?
Tell us something about keyword 'auto'.
What is actual argument?
What is cohesion in c?
What is a lookup table in c?
What is difference between stdio h and conio h?