weekhitc

weekhitc - if(i==0){

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

View Full Document Right Arrow Icon
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
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

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

This homework help was uploaded on 04/18/2008 for the course EME 5 taught by Professor Staff during the Fall '08 term at UC Davis.

Ask a homework question - tutors are online