CS10-8L: Computer Programming Laboratory
Exercise #3: Variables, Scripts and Visualizations
Name: RECTO, LESTHER SAIRY A. Score:
Section: B23 Date: 12-13-
2020
ANSWERS
1.
a. area.m
Perimeter: 80
Volume: 2062.5/2.0625e+03
Underground Surface Area: 815
Script:
>>L=25;
>>W=15;
>>P=2*(L+W)
P =
80
>>L=25;
W=15;
A=5.5;
V=(L*W)*A
V =
2.0625e+03
>>LplusW=40;
>>A=5.5;
>>L=25;
>>W=15;
>>USA=2*LplusW*A+L*W
USA =
815
b. fruits.m
Cost of Banana: 0.2900
Cost of Apple: 0.0500
Prepared by: Engr. Cheryl Mari M. Isip
Prepared date: August 2020
CS10-8L: Computer Programming Laboratory
Exercise #3: Variables, Scripts and Visualizations
Cost of Cantaloupe: 0.8900
Script:
>>a=[3 12 1;12 0 2;0 2 3];
>>b=[2.36;5.26;2.77];
>>x=a\b
x =
0.2900
0.0500
0.8900
c. temperature.m
Temperature in Fahrenheit: 98.6000
Script:
>>C = 37;
F = C*9/5 + 32;
disp(F);
98.6000
Prepared by: Engr. Cheryl Mari M. Isip
Prepared date: August 2020