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 getch() function?
Why c is a mother language?
What is break in c?
Write a program to reverse a linked list in c.
Can include files be nested? How many levels deep can include files be nested?
What is the purpose of ftell?
Explain main function in c?
What are the different types of linkage exist in c?
What are the application of void data type in c?
Is fortran still used today?
What is a sequential access file?
write a program to print largest number of each row of a 2D array
How does #define work?
Write a program to swap two numbers without using a temporary variable?
What is the translation phases used in c language?