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 example of a variable?
How can I remove the trailing spaces from a string?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
What 'lex' does?
What is const volatile variable in c?
What are preprocessor directives in c?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What is output redirection?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
What is use of integral promotions in c?
What is array in c with example?
What are the different types of control structures?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What are pointers? What are different types of pointers?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.