In this task, implement a getCentury()
function that:
- accepts the
year
variable; - returns a century this
year
is in.
Note that the first century begins from the year 1
and continues up to and including the year 100
, the second from the year 101
to the year 200
, and so on.
For example:
getCentury(1705) // 18
getCentury(1900) // 19
getCentury(1601) // 17
getCentury(2000) // 20