answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is the algorithm to reverse all the digits of an integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic
Related questions

Design an algorithm for finding all the factors of positive integerfor example in the case of the integer 12your algorithm should report 12346 and 12?

design an algorithm for finding all the factors of a positive integer


Name the only digit that is NOT an integer?

All digits all part of the set of integers.


How is an integer expressed in hexadecimal form?

It is expressed as a string of hexadecimal digits - all to the left of a "decimal" point.


Is it true that any even integer can be represented as a sum of two integers with all odd digits?

Yes. Yes. Yes. Yes.


Explain all the criteria that an algorithm must satisfy.?

algorithm is all about sex


What program can read n number must contain four- digits only and if the second left digit odd put it in an array if not ignore it?

Input the number as a string. If the string has a length of 4 and contains only digits, convert the string to an integer. If the integer is less than 1000, input another number. Otherwise, copy the integer and divide by 100 to get rid of the two least-significant digits. Divide again by 2 and take the remainder. If the remainder is 1 then the second left digit of the 4-digit integer is odd and the 4-digit integer can be added to the array, otherwise do not add it. Repeat for all n numbers.


What is the divisibility test for 15?

It is divisibility by 3 and divisibility by 5.Divisibility by 3: the digital root of an integer is obtained by adding together all the digits in the integer, with the process repeated if required. If the final result is 3, 6 or 9, then the integer is divisible by 3.Divisibility by 5: the integer ends in 0 or 5.


It is the smallest three-digit number with all the digits different?

My intuition suggests you are after a positive integer, so the answer is 102. However I suppose technically 0.12 also meets the criteria given (though it is not an integer). And if you can include negative integers then -987 would be the answer.


In java How do you have a method take in an int value and return an int containing sum of the individual digits in the number using a recursive method?

Add the last digit plus the sum of all the previous digits. The base case is that if your integer only has a single digit, just return the value of this digit. You can extract the last digit by taking the remainder of a division by 10 (number % 10), and the remaining digits by doing an integer division by 10.


Is an integer a terminating decimal?

Yes, integers are ...-3,-2,-1,0,1,2,3... all of which have an end and therefore terminate.Yes!Decimal numbers that have finite number of digits after decimal point are called terminating decimal numbers.For example,1.2, 2.3376, 4.79 are a few examples of terminating decimals.Every integer could be written as a decimal number.Like as follows:1 could be written as 1.02 could be written as 2.0-3 could be written as –3.0.We have not changed the value of the numbers but we have converted them in to decimal numbers.Source: www.icoachmath.com


Is 117 divisible by 9?

Yes. 117/9=13. An easy test for divisibility by nine (for an integer of any length) is to add all of the digits. If the sum is nine or a number divisible by nine, then the integer is divisible by nine. In this case, 1+1+7=9, so 117 is divisible by nine. (Be careful, this test fo divisibility only works generally for divisibility by three -- i.e., an integer is divisible by three if and only if the sum of its digits equals three or a multiiple of three-- and for nine.) To find if an integer is divisible by 4, you can check if the last two digits are. If they are, it is. To check if an integer is divisible by 6, you must make sure that the integer is divisible by both 3 and 2. If you want to check if an integer is divisible by 2, just make sure it's even. Any integer divisible by 10 will end in zero. Any integer divisible by 5 will end in either 5 or 0. This is an important part of pre-algebra, as well as algebra.


What are some examples of palindrome programs using letters and numbers?

When working with letters we must work with strings (character arrays). To determine if a string is a palindrome we use two pointers, one for each end of the string. So long as the characters pointed to are the same, we advance the pointers one character inwards. If the characters pointed at differ, the string is not a palindrome and we can stop checking. When the pointers meet or pass each other, the string must be a palindrome so we can stop checking. Note that the string must be composed entirely of letters of the same case (typically lower-case). All punctuation and word-spacing must also be removed since we're only interested in the letters. We achieve this by copying the string and manipulating the copy, leaving the original string intact. When working with integers, we simply reverse the digits and test to see if it is equal to the original integer. We achieve this by repeatedly dividing the integer by 10 and taking the remainder to extract each digit: Algorithm: reverse_integer Input: a positive integer, n Output: the integer reversed r = 0 repeat while n > 0 m = n % 10 // % = modulo (remainder after division by 10) r = r * 10 + m n = n / 10 end repeat return r A less efficient method is to convert the number to a string and then test the string. A real number is a palindrome when there are as many digits before the decimal point as there are after it, and the integer component is the reverse of the fractional component. We can test this by taking the integer component and reversing it using the algorithm above. We then convert back to a real number and divide by 10 until the number is less than 1. We than add on the original integer component and compare with the original real number. If they are equal, the real number is a palindrome.