Is it possible to add the numbers 1 to n recursively in Java with one return statement? How would you change the standard solution:
public static int sum(int n) {
if(n == 1) return n;
else return n + sum(n - 1);
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)