Write a program that allows the user to enter the coal usage at a power station for the first and second week of October in metric tonnes which is as follows:
Week 1: 29,31,29,30,30,28,35
Week 2: 33,37,28,32,31,30,32
#include<stdio.h>
int main(){
int week1[7];
int week2[7];
int i, j, k,n;
for(i=0; i<7; i++){
printf("Day %d\n", (i+1));
scanf("%d", &week1[i]);
}
for(j=0; j<7; j++){
printf("Day %d\n", (j+1));
scanf("%d", &week2[j]);
}
printf("Week 1 :");
for(k=0; k<7; k++){
printf(" %d ", week1[k]);
}
printf("\nWeek 2 :");
for(n=0; n<7; n++){
printf("%d ", week2[n]);
}
}
Comments
Leave a comment