quote:
Originally posted by Vilkku
We are supposed to make a program that asks the user for a year and the program will tell if it is one of those years with an extra day (forgot what it's called)
a leapyear.
quote:
Originally posted by Vilkku
We are supposed to do it with boolea, and theese are the requirements for the year:code:
(DivideableWith4 && !DivideableWith100) || DivideableWith400
Now, how can I easily get the program to check if it is possible to divide a number with those?
divide the number and check if there is a remainder.
This can either be done by comparing the integer division with a floating point division. eg:
floatingpoint = 101 / 4
integer = 101 \ 4
If floatingpoint == integer Then IsDivideableBy4
Or by the MOD function. eg:
If (101 MOD 4) * 4 = 101 Then IsDivideableBy4
Or maybe Java even has function which directly returns the remainder of a division (dunno). eg:
Remainder = 101 XXX 4
If Remainder = 0 Then IsDivideableBy4