Yahoo India Web Search

Search results

  1. Oct 13, 2008 · @Steve314 to describe an algorithm to convert an integer to a string, which of course requires you to understand modulo - no. Computing in the target number system, being able to add will do (think how you commonly convert from decimal to binary - being used to think computation means binary doesn't mean you can't do, e.g., decimal arithmetic (and you can do conversion from binary to decimal without division or modulo 2).

  2. Mar 1, 2010 · C program to find if a number is palindrome or not. 1. Program that checks if an array is a palindrome. 0 ...

  3. Nov 24, 2009 · This is my solution coming from a beginner: Console.Write("Enter a number to check if palindrome: "); bool palindrome = true; int x = int.Parse(Console.ReadLine()); /* c is x length minus 1 because when counting the strings. length it starts from 1 when it should start from 0*/. int c = x.ToString().Length - 1;

  4. Oct 10, 2018 · 3.Finding the reverse of a number. Note: A palindrome number is a number that reads the same from both ends. For example: 12321 -> palindrome number 23143 -> not palindrome number 7 -> palindrome number To check if a number is palindrome or not first find the reverse of that number if reverse is equal to that number then that number is ...

  5. Feb 7, 2019 · Since you are only printing the reversed number in your code, you don't need to construct the reversed number again. But if you do, it's quite trivial once you have the digits. reversed = 10000 * a + 1000 * b + 100 * c + 10 * d + e; I believe you can check if the number is a palindrome or not from here on (isPalindrome = (reversed == num)).

  6. Dec 26, 2015 · Finding the palindrome of a number in c. 3. Determine if input is a palindrome in C. 0. Palindrome Checker ...

  7. Nov 24, 2015 · Short answer: you forgot to call isPalindrom. Long answer: isPalindom decays to a nonnull function pointer, and nonnull pointers test true, this you always see the the if branch taken. Also: Yes, judging both by the name and the return type, reverse is intended to return the reverse of a number.

  8. Sep 30, 2014 · 1. String test = Integer.toString (number, 2); With this, the number will be represented in binary. The implementation is very simple. You loop till the middle of the String, and compare the char at the current position with the char on the respective position (test.length - current position).

  9. Sep 18, 2020 · return -1; is incorrect as -1 will be converted to true when the integer is converted to a boolean. Presumably you meant return false;. The last seven lines of your code could be simplified to one line return n == reverse;. Which means 'if n equals reverse then return true otherwise return false'.

  10. Jun 13, 2022 · I tried to solve this problem: check if the number is a palindrome, I know that there are a lot of examples on the Internet, but I don't understand why my code isn't working. using System; class

  1. People also search for