Wap to check a number is palindrome in c

Can you please explain me the mistake in the program below?

C program to check whether a number is palindrome or not - Trytoprogram

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service , privacy policy and cookie policy , and that your continued use of the website is subject to these policies. C program to find if a number is palindrome or not Ask Question.

You haven't checked the return value of scanf calls. How do you know they succeeded? Your scanf s are OK as long as you enter numbers.

Palindrome Number Program in C - C Language Tutorial - Mr. Srinivas

In order to raise power, you need to include math. I wear a lot of hats LVL 4. Obviously you would start down the path by reading in each line of the text file and tokenizing it using the strtok function. A space character would be the most logical choice for splitting each token within a given line.

C Program to Check whether the Given Number is a Palindromic

You also need to strip out punctuation so that you don't count it when traversing a given token to determine whether it is a palindrome. The traversal is easy. You simply determine the length of the string using strlen we'll call that length L , then you compare the character in position 0 to the character in position L-1 for equality, then 1 to L-2, 2 to L-3 and so on until you find a non-matching character or until i and j converge in the case of an odd number of characters in the word, the positional indexes will end up equal which is still a palindrome because the middle letter would count for both directions, in the case of an even number of characters, the indexes would "swap places" so the left index would end up higher by 1 than the right index.

Here's the heart of the code I've omitted the steps to loop through the file, tokenize each word, and strip punctuation: There are other kinds where palindrome spans several words: Go hang a salami, I'm a lasagna hog Egad a base tone denotes a bad age A man, a plan, a canal, Panama I leave the solution to this as an exercise for the reader just watch it end up being an NP-Complete problem HTH, Brian.


  1. World's #1 Programming site!!.
  2. What is Palindrome Number ?;
  3. Creating strrev() function.

Experts Exchange Solution brought to you by Your issues matter to us. Download the guide. LVL Harisha M G Engineer Commented: Please replace "harish.

Palindrome program in C

Another replacement: It's more than this solution. If we create a function with Void then there is no need to return any value but, if we declared a function with any data type int, float etc then we have return something out from the function.

Categories

This program for palindrome in c allows the user to enter any positive integer and then, this program will check whether the given number is Palindrome Number or Not using Recursive Functions concept. If you miss this statement then, after completing the first line it will terminate.

Search form

For example,. For Recursive functions it is very important to place a condition before using the function recursively otherwise, we will end up in infinite execution Same like Infinite Loop. This For Loop helps the compiler to iterate between Minimum and Maximum Variables, iteration starts at the Minimum and then it will not exceed Maximum variable.