CSC300: Does this work? [6/14] |
01 |
public static int numFives (double[] a) { return numFives (0, 0); } private static int numFives (int i, int result) { if (i>=a.length) return result; if (a[i] == 5.0) return numFives (i+1, result+1); else return numFives (i+1, result); } |