Source of Question4.java


  1: //Question4.java
  2: 
  3: public class Question4
  4: {
  5:     public static void main(String[] args)
  6:     {
  7:         System.out.println(mysteryValue(3));
  8:     }
  9: 
 10:     public static int mysteryValue
 11:     (
 12:         int n
 13:     )
 14:     {
 15:         if (n <= 1)
 16:             return 1;
 17:         else
 18:             return (mysteryValue(n - 1) + n);
 19:     }
 20: }