answersLogoWhite

0


Best Answer

Write a loop, in which you divide by each of the digits; if it's NOT divisible, set the variable "result", which you initiall set to "true", equal to "false".

The tricky part is extracting the digits; one way to do this is to convert the number to a string, and use string functions. You can also repeatedly divide by 10, and use the remainder. That is, first take the remainder and test it; then divide the remaining number by 10.

User Avatar

Wiki User

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

Anonymous

Lvl 1
3y ago

Hgi

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can I write a method that returns true if the number passed can be divided by all its digits?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you use Microsoft Excel roundup?

RoundUp function returns a number rounded up to a specified number of digits. (Rounds away from 0.)Syntax: RoundUp( number, digits )number = number to round updigits = number of digits to round the number up to


What is the smallest two digit number that can be divided by its own digits?

By the sum of its digits: 10. By each of its individual digits: 11.


What is a prime number with two identical digits?

11 is the only prime number with identical digits. After 11 all numbers with identical digits can be divided by atleast 11 or 3.


What is the square root of 4086248736408 and is it rational?

Here is a website with a method for determining the square root of any number: http://www.jimloy.com/arith/sqrt.htm Using a calculator, the closest square root of 4086248736408 to 8 significant digits is 2021447.2. You need to use the method referenced in the URL to find the answer to additional significant digits. If the answer can be divided by any whole number and the result is a whole number, then the square root is a rational number.


How can you tell if a number is divisible by 3?

You can tell if the sum of the digits can be divided by 3.


What 4 digits palindrome number can be divided by 7 without a remainder?

0.5714


A composite number that can be divided by 3 that isn't prime that is three digits?

102


When can a number divided by 3?

If the digits of a number add up to a multiple of 3, then the number can be divided by 3. For example, the digits of 852 add up to 8 + 5 + 2 = 15. Since 15 is divisible by 3, 852 is divisible by 3.


When the number is divided by 3 the sum of the digits can be divided by 3?

1


Three digit number that can be divided by 5?

Any number that ends in 0 or 5 and has three digits.


When a number is divided by 100 the digits move?

The digits should stay where they are. The decimal point should move 2 places to the left.


Explain how to predict the number of digits in the quotient for 9010 divided by 8?

1126.25