카타 8급 Century From Year

1 C[ | ]

int centuryFromYear(int year) {
  return (year+99)/100;
}

2 C++[ | ]

int centuryFromYear(int year) 
{
  return (year+99)/100;
}

3 Go[ | ]

package kata
func century(year int) int {
  return (year+99)/100;
}

4 Kotlin[ | ]

fun century(number: Int): Int {
    return (number+99)/100
}
fun century(number: Int): Int {
    return ceil(number / 100.0).toInt()
}
fun century(number: Int): Int {
    return ((number - 1) / 100).toInt() + 1
}

5 R[ | ]

century <- function(year) {
  (year+99) %/% 100
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}