Write a program that reads an integer N and prints the result of incrementing N by 1 and then decrementing the result by 2.
Increment and decrement
Increment, then decrement an integer
Report a typo
Sample Input 1:
5Sample Output 1:
4Sample Input 2:
10Sample Output 2:
9Write a program in Kotlin
// import required to read input from stdin
import java.util.Scanner
fun main() {
val scanner = Scanner(System.`in`)
// Read the input integer
val N = scanner.nextInt()
// TODO: Increment N by 1
// TODO: Decrement the result by 2
// Print the final result
println(N)
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.