- #1
tawi
- 33
- 0
Hello,
My task is to write a program that after reading a positive integer i (from 0 to 1000) will write how many "nice numbers" are in the interval [0..i]. "Nice numbers" are numbers that are divisible by their every digit. For example 612 is a nice number becasuse it is divisible by 6,1 and 2. One the other hand 512 is not a nice number because it is not divisible by 5. And I need a little help with it.
Example of an input:
24
Corresponding output:
14
- in the interval [0,24] we can find these 14 nice numbers:
1 2 3 4 5 6 7 8 9 11 12 15 22 24
Thank you for your help.
My task is to write a program that after reading a positive integer i (from 0 to 1000) will write how many "nice numbers" are in the interval [0..i]. "Nice numbers" are numbers that are divisible by their every digit. For example 612 is a nice number becasuse it is divisible by 6,1 and 2. One the other hand 512 is not a nice number because it is not divisible by 5. And I need a little help with it.
Example of an input:
24
Corresponding output:
14
- in the interval [0,24] we can find these 14 nice numbers:
1 2 3 4 5 6 7 8 9 11 12 15 22 24
Thank you for your help.