#include<stdio.h> void main() { int day,train,max=0,pass,total,rainer; for(day=1;day<=7;day++){ printf("We are on Day # %d\n\r",day); total=0; for(train=1;train<=3;train++){ printf("how many passengers on train # %d?\n\r",train); scanf("%d",&pass); total=total+pass;} printf("Total Passengers on day # %d are %d\n\r", day,total); if(pass>max) max=pass; if(pass==max) rainer=train; printf("The Maximum passengers were: %d on train # %d\n\r",max,rainer); } }
|