I am writing a program for my programming class and I have run into a problem. I got the entire program completed/compiled, but for the output, it's printing only zeros?
This is the HW problem:
- A class of students received scores of 81.4, 75.3, 90.0, 96.9, and 85.6. Declare and initialize an array named “scores” to store these values. Write a loop to display the contents of scores. Make sure that your printout is readable with spaces or commas between each grade. For example:
The scores are: 81.4 75.3 90 96.9 85.6
And here is my program:
Thank you in advance for any help!Code:# include <stdio.h> int main() { double score[5]; int i; score[0]= 81.4; score[1]= 75.3; score[2]= 90.0; score[3]= 96.9; score[4]= 85.6; printf( "The grades are:\n" ); for (i=0; i < sizeof(score)/sizeof(*score); i++) { printf("%.1lf,", score[5]); } printf("\n"); return 0; }