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