Generation

generate functionMon, 17 Jul 2023

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.

function centuryFromYear(year) { return Math.ceil(year/100); } centuryFromYear(1905)

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant