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

5 Tips from my first month using Gatsby

Executing single AWS lambda in multiple accounts

Powering forex markets in Polygon

Mobile test automation practices  Part 2: preconditions, elements verification and independent…

🚀BeGlobal.finance first 15 days after launch

Agile Project Management with GitLab vs JIRA

Wall Jump in Unity

Why project estimates can vary between €4K and €400K?

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

How to Avoid Model Changes Nightmare in Java or Kotlin

Null Safety in Kotlin

Why Android developer ❤ to use Kotlin as a main language besides Java?

Kotlin Programming Language: Everything You Need to Know