import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static int sumNumbersRecursive(int n) {
if (n == 0) {
return 0;
} else {
return n + sumNumbersRecursive(n - 1);
}
}
public static void main
(String[] args
) { int n = 5; // Replace 5 with the desired value of N
int result = sumNumbersRecursive(n);
System.
out.
println("The sum of numbers from 0 to " + n
+ " is: " + result
); }
}
IAppbXBvcnQgamF2YS51dGlsLio7CmltcG9ydCBqYXZhLmxhbmcuKjsKaW1wb3J0IGphdmEuaW8uKjsKIAovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKICAgIHB1YmxpYyBzdGF0aWMgaW50IHN1bU51bWJlcnNSZWN1cnNpdmUoaW50IG4pIHsKICAgICAgICBpZiAobiA9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBuICsgc3VtTnVtYmVyc1JlY3Vyc2l2ZShuIC0gMSk7CiAgICAgICAgfQogICAgfQogCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgaW50IG4gPSA1OyAvLyBSZXBsYWNlIDUgd2l0aCB0aGUgZGVzaXJlZCB2YWx1ZSBvZiBOCiAgICAgICAgaW50IHJlc3VsdCA9IHN1bU51bWJlcnNSZWN1cnNpdmUobik7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJUaGUgc3VtIG9mIG51bWJlcnMgZnJvbSAwIHRvICIgKyBuICsgIiBpczogIiArIHJlc3VsdCk7CiAgICB9CiAKIAp9