Days forward

Report a typo

The function daysForward(date: String, days: Int), where date is an ISO 8601 string representing a date (for example, 2000-01-01) and days is an integer representing the number of days, prints an ISO 8601 string representing the date that comes days days after the date.

For example, if date is 2022-01-01 and days is 137, then this function prints 2022-05-18.

Write the correct code for the daysForward() function.

This task uses dependencies that may not be available in your local IDE. As a result, you may see compilation errors or unresolved references when running the code locally. This does not affect solution validation when you submit your solution to Hyperskill.

Sample Input 1:

2000-01-01
15

Sample Output 1:

2000-01-16
Write a program in Kotlin
import kotlinx.datetime.*

fun daysForward(date: String, days: Int) {
// Write your code here

//
}

fun main() {
val date = readln()
val days = readln().toInt()
daysForward(date, days)
}

Create a free account to access the full topic