it's my midterm exam week!!!!!! just so terrible~~
Year is leap if its number is divisible by 4 and isn't divisible by 100 or if its number is divisible by 400. Determine if a given year is leap or not.[input] integer year number of the year
[output] boolean true if the given year is leap, false otherwise
bool leapYear(int year) { if (year % 4 == 0 && year % 100 !=0 || year % 400 == 0) { return true; } return false; }
沒有留言:
張貼留言