// // program to count down from n to 0 (print numbers from n to 0) // // function to do the counting def countdown(n : Int) { if (n > 0) { // reverse the next two statements to count up println(n) countdown(n-1) } else { println(n) } } // main program -- prompt for input and call function println("enter the starting number (>= 0):") val num = readInt if (num < 0) { println("too small!") } else { countdown(num) }