Stuff, Things

This commit is contained in:
Shaquille Soekhlal
2019-10-11 22:34:52 +02:00
parent 7c6fcb78b3
commit 957e7d3ed0
5 changed files with 122 additions and 7 deletions

33
Assignment 7/main.c Normal file
View File

@ -0,0 +1,33 @@
/*
* 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;
}