Goodmorning, good evening and goodnight all :)
I am struggling with the modulo-exercise.
Lets take this as an example:
year%400==0
If we fill in the year 1900 then the remainder is 300.
1) Does the above code then mean 300 is true or does it mean 300 is equal to 0?
2) if the remainder is indeed 300, why is it then a regular year??
I hope you could help me :)
Stuggling with Modulo
Resolved
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Mohammed Amine EL AMRANI
22 December 2018, 23:16
Hello,
Apply this :
+2
Guadalupe Gagnon
22 December 2018, 21:12
if the year is 1900 and you modulo it by 400, then the result is 300. The % sign returns the remainder after division, while the double equal sign (==) checks if the values on its left and right are equal. That means the 300 is checked to see if it is equal to 0, which it is not, so the return value of that statement is false.
+1
Sabine Meijran-Prins
23 December 2018, 09:45
ohhhh is it that simple, thank you sooo much :)
+1