Leap year how to solve it?any ways | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Leap year how to solve it?any ways

How to make leap year divide even

9th Jan 2022, 1:35 PM
Igor Stadnyk
2 ответов
+ 1
Hello Igor Stadnyk first show your attempt
9th Jan 2022, 3:12 PM
MATOVU CALEB
MATOVU CALEB - avatar
+ 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
9th Jan 2022, 10:02 PM
Brian
Brian - avatar