Return To CS 110 Home

Colour Theme   Font Size Options
 
   
   
   
Check Leap Year

Check Leap Year


Video Summary: https://youtu.be/xBzcCq04Iuk


In this exercise, you will check if a year is a leap year. Each check will be divided into a sub-function.

A year is a leap year if it is divisible by 400, or divisible by 4 but not divisible by 100.

  1. Create a function called checkLeapYear that takes an int year and returns bool
  2. Create three functions to check if a number is divisible by 400, 4, and 100. Each should also return a bool
  3. Call these functions from checkLeapYear
  4. If the conditions are met and it is a leap year, have checkLeapYear return true, otherwise return false
  5. Print the result

Solution