answersLogoWhite

0


Best Answer

#include <stdio.h>

#include <conio.h>

void main()

{

int num,rev=0,m,r;

clrscr();

printf("enter any number");

scanf("%d",&num);

m=num;

while(num>0)

{

r=num%10;

rev=rev*10+r;

num=num/10;

}

if(rev==m)

printf("given number is palindrome");

else

printf("given number is not palindrome");

getch();

}

this is the answer.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

Note: The following is pseudo-code (I tried to make it as close to code as possible)

Because there are so many programming languages it would not be good to answer

this question with one language. So, you should be able to take this pseudo-code and

finish it in your language. This is very close to C.

integer palindrome(char[] string)

{

if (length(string) 0) /* we are looking at the last 2 characters

return 1 (true)

palindrome(newstring[]); /* Call palindrome again with two less characters */

}

return 0 (false)

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to check palindrome using recursion?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the C program for heap sort using recursion?

123


Write a program using recursion which should take two values and display 1st value raised to the power of second value?

Write a program using recursion which should take two values and display 1st value raised to the power of second value.


Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


Can you implement merge sort without using recursion?

Sure, recursion can always be substituted with using a stack.


Advantages and disadvantages of using recursion?

pata nhe


What are the merits and demerits of recursion?

Ans: Merits of recursion are: Mathematical functions, such as Fibonacci series generation can be easily implemented using recursion as compared to iteration technique. Demerits of recursion are: Many programming languages do not support recursion; hence, recursive mathematical function is implemented using iterative methods. Even though mathematical functions can be easily implemented using recursion, it is always at the cost of execution time and memory space. The recursive programs take considerably more storage and take more time during processing.


Write a program using method plainto check whether a string is a palindrome or not A palindrome is a string that reads the same from left to right and vice-versa?

Palindrome number is a number like 121 which remains the same when its digits are reversed. To find this number in a simple java program, just follow the below way. sum = 0; while(n&gt;0) { r=n % 10; sum=concat(r); n=n / 10; } print r;


C program for summation of n nos using recursion?

int sum (int n) { if (n&lt;=1) return n; else return n + sum (n-1); }


Program to find sum of n numbers using recursion function?

int sum(n) { if (n==0) return 0; else return n+sum(n-1); }


Can you provide a solution to the diamond-square algorithm using Java and recursion?

Yes. It is possible to provide a solution to the diamond-square algorithm using Java and recursion.


How do you write print 1 to 100 using recursion only?

recu


What are demerits of recursion?

Demerits of recursion are: Many programming languages do not support recursion; hence, recursive mathematical function is implemented using iterative methods. Even though mathematical functions can be easily implemented using recursion, it is always at the cost of execution time and memory space. The recursive programs take considerably more storage and take more time during processing.