Q:

Write a program to print numbers from 10 to 1 using recursion function

belongs to collection: Kotlin programming Exercises

0

Write a program to print numbers from 10 to 1 using recursion function

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

fun main(args : Array<String>)  { 
    for (x in 10 downTo 1)
    println("$x")
}

Output:

10
9
8
7
6
5
4
3
2
1

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a program in kotlin to differentiate between... >>
<< Write a program in Kotlin to print prime numbers b...