Day 4 is to calculate a century based on the value of year.
For instance year 1700 will be 17 centuries. And 1905 will be 20 centuries.
There is JavaScript solution
function centuryFromYear(num) { let modulo = (num % 100 === 0) ? 0 : 1; let centuries = Math.floor(num / 100); return modulo + centuries; }
Top comments (0)