Hello,
First of all that is exercise 21, not 24. Please edit the title.
You can find the algorithm of the Leap year on Wikipedia:
if (year is not exactly divisible by 4) then (it is a common year)
else
if (year is not exactly divisible by 100) then (it is a leap year)
else
if (year is not exactly divisible by 400) then (it is a common year)
else (it is a leap year)
So, you can use the following formula to find out if the year is or isn't divisible with a certain number:
year%100 == 0 //is divisible to 100
year%100 != 0 // isn't divisible to 100
Kind regards,
Gabi Nan