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 the Purpose of 'extern' keyword in a function declaration?
Explain the difference between null pointer and void pointer.
What is %g in c?
How can I delete a file?
Explain can static variables be declared in a header file?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
Explain can you assign a different address to an array tag?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
How many identifiers are there in c?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
Is calloc better than malloc?
What are the types of macro formats?
What are the basic data types associated with c?
why we wont use '&' sing in aceesing the string using scanf
Which of these functions is safer to use : fgets(), gets()? Why?