int centuryFromYear(int year) {
return 1 + (year-1)/100;
}
function centuryFromYear(year) {
return 1 + Math.floor((year-1)/100)
}
def centuryFromYear(year):
# // -> Floor division - division that results into whole number adjusted to the left in the number line. Example: 15//4 = 3
return 1 + (year - 1) // 100
# Description:
Given a year, return the century it is in.
The first century spans from the year 1 up to and including the year 100,
the second - from the year 101 up to and including the year 200, etc.