Skip to content

Commit ca6c631

Browse files
committed
Add a question
1 parent 3e6652e commit ca6c631

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| 8 | [Century From Year](#century-from-year) |
1010
| 8 | [Even or Odd](#even-or-odd) |
1111
| 6 | [Find the Odd Int](#find-the-odd-int) |
12+
| 8 | [Is n Divisible by x and y?](#is-n-divisible-by-x-and-y) |
1213
| 8 | [Keep Hydrated!](#keep-hydrated) |
1314
| 6 | [Multiples of 3 or 5](#multiples-of-3-or-5) |
1415
| 8 | [Multiply](#multiply) |
@@ -102,6 +103,34 @@ public class FindOdd {
102103

103104
**[⬆ Back to Top](#challenges)**
104105

106+
## Is n Divisible by x and y?
107+
108+
Create a function that checks if a number `n` is divisible by two numbers `x` AND `y`. All inputs are positive, non-zero digits.
109+
110+
```java
111+
public class DivisibleNb {
112+
public static boolean isDivisible(long n, long x, long y) {
113+
// Your solution
114+
}
115+
}
116+
```
117+
118+
<details><summary>Solution</summary>
119+
120+
```java
121+
public class DivisibleNb {
122+
public static boolean isDivisible(long n, long x, long y) {
123+
return (n % x == 0) && (n % y == 0);
124+
}
125+
}
126+
```
127+
128+
</details>
129+
130+
---
131+
132+
**[⬆ Back to Top](#challenges)**
133+
105134
## Keep Hydrated!
106135

107136
Nathan loves cycling. Because Nathan knows it is important to stay hydrated, he drinks 0.5 litres of water per hour of cycling. You get given the time in hours and you need to return the number of litres Nathan will drink, rounded to the smallest value.

0 commit comments

Comments
 (0)