answersLogoWhite

0


Best Answer

int nearPalin(int n){ int temp = n; int count = 0; while(temp>0){ temp /= 10; count++; } if(count%2 == 0){ count = count/2; while(count--) n = n / 10; temp = n; while(n>0){ temp = temp*10 + n%10; n = n/10; } return temp; } else{ count = count/2; while(count--) n = n / 10; temp = n; n = n/10; while(n>0){ temp = temp*10 + n%10; n = n/10; } return temp; } }

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you find the nearest palindrome of any number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

How many numbers in a palindrome?

One. If you mean "digits", the number can have any amount of digits; the only requirement to be called a "palindrome" is that if you read it backwards, you get the same sequence of digits. Thus, any of the following is a palindrome: 1 (any 1-digit number is a palindrome), 55, 121, 2002, 12321, 600006, 8105018, ... As you can see, you can make them arbitrarily large.


What is a 1 step palindrome?

A 1 step palindrome is a word, phrase, or sequence that remains the same when read forwards and backwards, without any rearrangement or flipping of letters. Examples include "level," "deed," and "madam."


What number is rounded to 1000000?

The answer depends on the degree of rounding. To the nearest million, any number between 500000 and 1500000. [the number could be 1499999.997, so the upper limit is NOT 1499999] To the nearest hundred thousand, any number between 950000 and 1050000 To the nearest ten thousand, any number between 995000 and 1005000 ... To the nearest unit, any number between 999995 and 1000005 To the nearest tenth, any number between 999999.5 and 1000000.5 To the nearest hundredth, any number between 999999.95 and 1000000.05 etc.


Is the number 8 a palindrome or Fibonacci sequence?

Any single digit number is a palindrome. The Fibonacci sequence consists of infinitely many numbers so 8, being only one number, cannot be the Fibonacci sequence.


What does it mean to round a whole number?

It is to find a whole number which is a multiple of ten to give the nearest ten. The rounding could be to the nearest dozen (12), 25, 50, 100 or any convenient whole number.

Related questions

Which 4 digit number is always a palindrome?

Any number that is is a palindrome will always be a palindrome.


What is a 1-step palindrome?

A "one step palindrome is "any number can be changed into a palindrome number by reversing the digits and adding to the original number" one time. For example, the number 23 can be turned into a palindrome in just one step: 23 + 32 = 55 The same goes for the number 12: 12 + 21 = 33


How many numbers in a palindrome?

One. If you mean "digits", the number can have any amount of digits; the only requirement to be called a "palindrome" is that if you read it backwards, you get the same sequence of digits. Thus, any of the following is a palindrome: 1 (any 1-digit number is a palindrome), 55, 121, 2002, 12321, 600006, 8105018, ... As you can see, you can make them arbitrarily large.


What is a word or phrase or a number called that can be read in any direction?

A palindrome.


What is the smallest and biggest palindromic number?

Since a palindrome is just a number that reads the same way back and forth, the smallest palindrome would be 1. As there are an infinite number of palindromes (as you could just take any palindrome and simply place the same number in front of it and behind it, for example: 3, 939,99399,9993999,999939999, etc.), there is no biggest palindrome (infinity)


What is a 1 step palindrome?

A 1 step palindrome is a word, phrase, or sequence that remains the same when read forwards and backwards, without any rearrangement or flipping of letters. Examples include "level," "deed," and "madam."


What number makes a pailindrome?

A palindrome is any number that, if you "read it backwards", is equal to the original number, for example, 12421.


What number is rounded to 1000000?

The answer depends on the degree of rounding. To the nearest million, any number between 500000 and 1500000. [the number could be 1499999.997, so the upper limit is NOT 1499999] To the nearest hundred thousand, any number between 950000 and 1050000 To the nearest ten thousand, any number between 995000 and 1005000 ... To the nearest unit, any number between 999995 and 1000005 To the nearest tenth, any number between 999999.5 and 1000000.5 To the nearest hundredth, any number between 999999.95 and 1000000.05 etc.


Is the number 8 a palindrome or Fibonacci sequence?

Any single digit number is a palindrome. The Fibonacci sequence consists of infinitely many numbers so 8, being only one number, cannot be the Fibonacci sequence.


What does it mean to round a whole number?

It is to find a whole number which is a multiple of ten to give the nearest ten. The rounding could be to the nearest dozen (12), 25, 50, 100 or any convenient whole number.


What are examples of 3 digit numbers that transform into palindromes?

Any, and every, number can be transformed into a palindrome.


What is the numerical palindrome?

Any number that reads the same forwards and backwards, like 33 or 45654.