# question4 ece

unknown
plain_text
3 years ago
1.1 kB
2
Indexable
Never
```%cevap 1 starts
foods = {'G1'; 'G2'; 'G3'};

A = [4; 1; 5];
B = [2; 5; 0];
C = [1; 0; 0];
D = [3; 6; 3];

vitamin_amount = table(foods, A, B, C, D);
%cevap 1 ends

%cevap 2 starts
vitA = 3*vitamin_amount{1,2} + 17*vitamin_amount{2,2} + 9*vitamin_amount{3,2};
vitB = 3*vitamin_amount{1,3} + 17*vitamin_amount{2,3} + 9*vitamin_amount{3,3};
vitC = 3*vitamin_amount{1,4} + 17*vitamin_amount{2,4} + 9*vitamin_amount{3,4};
vitD = 3*vitamin_amount{1,5} + 17*vitamin_amount{2,5} + 9*vitamin_amount{3,5};
fprintf("[Vitamin A: %d] [Vitamin B: %d] [Vitamin C: %d] [Vitamin D: %d]\n", vitA, vitB, vitC, vitD);
%cevap 2 ends

%cevap 3 starts
g1 = 20*vitamin_amount{1,2} + 53*vitamin_amount{1,3} + 47*vitamin_amount{1,4} + 39*vitamin_amount{1,5};
g2 = 20*vitamin_amount{2,2} + 53*vitamin_amount{2,3} + 47*vitamin_amount{2,4} + 39*vitamin_amount{2,5};
g3 = 20*vitamin_amount{3,2} + 53*vitamin_amount{3,3} + 47*vitamin_amount{3,4} + 39*vitamin_amount{3,5};
fprintf("[G1: %d TL] [G2: %d TL] [G3: %d TL]\n", g1, g2, g3);
%cevap 3 ends

%cevap 4 starts
sum = 3*g1 + 17*g2 + 9*g3;
fprintf("Total price: %d TL", sum);
%cevap 4 ends```