CSC300: Does this work? [3/12] Previous pageContentsNext page

01
02
03
04
05
06
07
08
  public static int numFives (double[] a) {
    double[] list = new double[] { 4, 5, 6, 5, 3 };
    int result = 0;
    for (int i=0; i<list.length; i++)
      if (list[i] == 5.0)
        result++;   
    return result;
  }

Previous pageContentsNext page