Qtr No. 213, New Town Yehlanka
Indore 454775, India
What will be the output of the code given below?
public class Tester {
public static void main(String[] args) {
System.out.println(demo(5, 1));
}
public static int demo(int x, int y) {
if (x == 0)
return 1;
else if (y > x)
return 0;
else
return (y + demo(x - 1, y + 1));
}
}
6
0
15
18
To get all Self Assessment - Programming using Java Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee