commments for 6 and 7. 9 works, 8 does not

This commit is contained in:
Shaquille Soekhlal
2019-10-24 16:17:22 +02:00
parent 957e7d3ed0
commit d66acc2641
5 changed files with 133 additions and 18 deletions

View File

@ -9,23 +9,23 @@
#include<math.h>
int main(){
int m,n,i,j,c;
double price[100] = {0};
int matrix[100][100];
scanf("%d",&n);
for(i = 0; i<n; i++){
scanf("%lf", &price[i]);
}
scanf("%d",&m);
for(j = 0; j<m; j++){
for (c = 0; c < n; c++){
scanf("%d",&matrix[c][j]);
int m,n,i,j,c; /*Declare Variables*/
double price[100]; /*Declare array price*/
int matrix[100][100]; /*Declare array matrix*/
scanf("%d",&n); /*Get amount of items*/
for(i = 0; i<n; i++){ /*Loop to get price for every item and store them into array price*/
scanf("%lf", &price[i]);
}
scanf("%d",&m); /*Get amount of customers*/
for(j = 0; j<m; j++){ /*Loop the following code for every custromer*/
for (c = 0; c < n; c++){ /*Loop to get amount of every item and store amount of customers and amount of items they buy in matrix*/
scanf("%d",&matrix[c][j]);
}
}
for (j = 0; j<m; j++){
for (j = 0; j<m; j++){ /*Loop the following code for every custromer*/
float total = 0;
for(c = 0; c < n; c++){
total += matrix[c][j]*price[c];
for(c = 0; c < n; c++){ /*Calculating total*/
total += matrix[c][j]*price[c];
}
printf("%.2f\n", total);
}