- 1

CodingBat Java exercise

Return true if the given non-negative number is 1 or 2 less than multiple of 20. So for example 38 and 39 return true, but 40 returns false. ?

17th Jul 2017, 6:53 PM
Petra LajerovĂĄ
Petra LajerovĂĄ - avatar
1 Answer
+ 8
you can use % which return the remaining of dividing a number to 20 and check if it return 18 or 19.
17th Jul 2017, 7:04 PM
Farshad
Farshad - avatar