01 02 03 04 05 06 07 08 09 10 11
public static int numFives (double[] a) { int result = 0; for (int i=0; i<a.length; i++) { if (a[i] == 5.0) result++; else return result; return result; } StdOut.print (result); }