Power and scopes

Report a typo

You have a program that prints the variable thirteen equal to 13 raised to the power of 2 to 10. There is a loop that raises the number 13 to a power at each iteration. Now the program prints only the result of exponentiation to the 2nd power.

Change the code below so that it prints the correct result (9 numbers, each on a new line).

Tip: You need to change the scope of the variable thirteen by moving one line of code.

Write a program in Kotlin
fun main() {
// change the code below

for (i in 2..10) {
var thirteen = 13L
thirteen *= 13
println(thirteen)
}
}
___

Create a free account to access the full topic