Fibonacci sequence

Report a typo

Modify a program below to output the first 5 Fibonacci numbers, each on a new line.

Write a program in Scala 3
@main def fibonacci = {
val a = 0
val b = 1
def sum(a: Int, b: Int): Int = ???

println(a)
println(b)
println(sum(a, b))
println(sum(???))
println(sum(sum(???), ???))
}
___

Create a free account to access the full topic