Digital-Systems-Assignments/Assignment 7/main.c

33 lines
622 B
C
Raw Normal View History

2019-10-11 20:34:52 +00:00
/*
* Student: S.K. Soekhlal
* Number: 4860632
* Assignment: 4.3
*/
#include<stdio.h>
#include<stdlib.h>
#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]);
}
}
for (j = 0; j<m; j++){
float total = 0;
for(c = 0; c < n; c++){
total += matrix[c][j]*price[c];
}
printf("%.2f\n", total);
}
return 0;
}