الرجوع
تسجيل الدخول

What is the output of the following?

public static int num(int n) {
    if (n == 0) {
        return 0;
    } else {
        return n + num(n + 1);
    }
}

public static void main(String[] args) {
    int n = -4;
    System.out.println(num(n));
}