Day of the Programmer solution in Kotlin -HackerRank

  • Divisible by 400.
  • Divisible by 4 and not divisible by 100.
  • year: an Integer
2017
13.09.2017
fun dayOfProgrammer(year: Int): String {    var result = ""

if (year >= 1700 && year <= 1917) {
result = if (year%4 == 0) "12.09.$year" else "13.09.$year"
} else if (year == 1918) {
result = "26.09.$year"
} else {
if (year%400 == 0) {
result = "12.09.$year"
} else if (year%4==0 && year%100 != 0) {
result = "12.09.$year"
} else {
result = "13.09.$year"
}
}
return result
}

--

--

--

Hey curious person, I am Software Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fantastic Features and How to Hide Them

CS373 Spring 2022: William Johnston

Choosing Your First PoC to Develop with CAIOS

glTF: An Image Format for AR/VR

Beterano sa Tech na si Jeffrey Lacouture ay Sumali sa Syntropy bilang Chief Revenue Officer

Productivity Abound

Is SurfEasy Good For Torrenting?

How to quickly build an API with Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Umar Syaid Himawan

Umar Syaid Himawan

Hey curious person, I am Software Developer

More from Medium

Is Gradle hard to learn ?

Error Handling the FP way; using Kotlin

The BigDecimal pitfall

JDK 17 — Unsupported Class File Major Version