CSC300 / CSC402: Does this work? [7/14] Previous pageContentsNext page

01
02
03
04
05
06
07
08
09
10
11
12
13
  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);
  }

Previous pageContentsNext page