CHALLENGE
ACTIVITY
5.4.5: Printing array elements separated by commas
Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If
hourlyTemp = (90, 92, 94, 95), print:
90, 92, 94, 95
Your code's output should end with the last element, without a subsequent comma, space, or newline.
Learn how our autograder works
3 int main(void) {
4 const int NUM_VALS = 4;
5 int hourlyTemp[NUM_VALS];
6 int i;
7
8 for (i = 0; i < NUM_VALS; ++i) {
9 scanf("%d", &(hourlyTemp[i]));
10 }
11
12 // Your solution goes here //
13
14 printf("\n");
15
16 return 0;
17 }