Q:

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

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now