When a year can be divided by 4, it may be a leap year. In that sense, when it can be divided by 100 but cannot be divided by 400 ,it is not a leap year. In other situations it is. Simply you miss some cases in year % 4 == 0 situation.