0

# Leap year how to solve it?any ways

How to make leap year divide even

2 Answers

+ 1

Hello Igor Stadnyk first show your attempt

+ 1

Igor Stadnyk have you learned about the modulo operator, %, that can tell you whether a number divides evenly?
No? Well until then here is an alternative. Compare whether the float division result is equal to the integer division result.
if (a/b == Math.floor(a/b)) // evenly divides