{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

weekhitc

# weekhitc - if(i==0...

This preview shows page 1. Sign up to view the full content.

Sheet1 Page 1 #include<stdio.h> #define WEEK 5 #define DAY 7 int main () { int a [WEEK][DAY]={367,654,545,556,565,526,437, 389,689,554,526,625,537,468, 429,644,586,626,652,546,493, 449,689,597,679,696,568,522, 489,729,627,729,737,598,552} int i,j,total=0,weektotal double avg printf("Day of Week Mean\n") printf("------------------\n") for(i=0 i<DAY i++) { weektotal=0 for(j=0 j<WEEK j++){ weektotal+=a[j][i] total+=a[j][i] } avg=(double)weektotal/DAY
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if(i==0){ printf("%s%13.2f\n","Monday",avg) } else if(i==1){ printf("%s%12.2f\n","Tuesday",avg) } else if(i==2){ printf("%s%10.2f\n","Wednesday",avg) } else if(i==3){ printf("%s%11.2f\n","Thursday",avg) } else if(i==4){ printf("%s%13.2f\n","Friday",avg) } else if(i==5){ printf("%s%11.2f\n","Saturday",avg) } else{ printf("%s%13.2f\n","Sunday",avg) } } return 0 }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online