Problem Statement |
| You are given an integer num from which you should replace the last two digits such that the resulting number is divisible by factor and is also the smallest possible number. Return the two replacement digits as a String.
For instance:
if num = 275, and factor = 5, you would return "00" because 200 is divisible by 5.
if num = 1021, and factor = 11, you would return "01" because 1001 is divisible by 11.
if num = 70000, and factor = 17, you would return "06" because 70006 is divisible by 17.
|
|
Definition |
| Class: | DivToZero | Method: | lastTwo | Parameters: | int, int | Returns: | String | Method signature: | String lastTwo(int num, int factor) | (be sure your method is public) |
|
|
|
|
Constraints |
- | factor must be between 1 and 100, inclusive. |
- | num must be between 100 and 2,000,000,000, inclusive. |
|
Examples |
0) | |
| |
1) | |
| |
2) | |
| |
3) | |
| |
4) | |
| |