/** Precondition: n>=1 Returns the sum of the squares of the numbers 1 through n. */ public static int squares(int n) { if(n<1) { return 1; } else { sum+=Math.pow(n, 2); squares(n-1); return sum; } }
/** Precondition: n>=1 Returns the sum of the squares of the numbers 1 through n. */ public static int squares(int n) { if(n<1) { return 1; } else { sum+=Math.pow(n, 2); squares(n-1); return sum; } }