Calculating something recursive to feel why we need computers after all.

Report a typo

Given function F, what's the sum of all numbers it prints if called as f(2)?

fun f(n : Int)
{
    println(n)
    if(n < 5)
    {
        f(n+1)
        f(n+3)
    }
}
Enter a number
___

Create a free account to access the full topic