softnshare / kata

Code Kata 這個概念是由 The Pragmatic Programmer 的作者之一Dave Thomas提出的, 想要提升自己的coding skill嗎? 歡迎加入這個slack channel, 加入請參考右邊網頁說明
https://softnshare.wordpress.com/slack/kata/
38 stars 4 forks source link

Century From Year #34

Open freedom5566 opened 6 years ago

freedom5566 commented 6 years ago

https://www.codewars.com/kata/century-from-year/

題目

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.

Task : Given a year, return the century it is in.

Input , Output Examples ::

centuryFromYear(1705)  returns (18)
centuryFromYear(1900)  returns (19)
centuryFromYear(1601)  returns (17)
centuryFromYear(2000)  returns (20)

第一世紀是從1年到100年,包括100年,第二世紀-從101年到200年以此類推

你的任務是

給你一個西元年,回傳該年的世紀