Skip to content

Instantly share code, notes, and snippets.

@viveknarang
Created October 3, 2017 20:35
Show Gist options
  • Save viveknarang/351aeae662418c15908509237713c18f to your computer and use it in GitHub Desktop.
Save viveknarang/351aeae662418c15908509237713c18f to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class PrintWithComma {
public static void main (String [] args) {
final int NUM_VALS = 4;
int[] hourlyTemp = new int[NUM_VALS];
int i;
hourlyTemp[0] = 90;
hourlyTemp[1] = 92;
hourlyTemp[2] = 94;
hourlyTemp[3] = 95;
/* Your solution goes here */
for (i = 0; i < NUM_VALS; i++) {
System.out.print(hourlyTemp[i]);
if (i < NUM_VALS - 1) {
System.out.print(", ");
}
}
System.out.println("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment