0% found this document useful (0 votes)
35 views1 page

%MATLAB Programming %tugas - 1 %kelas: EL - 2F %by: Rahmat P Siagian %NIM: 1605033012 %pemograman Komputer

This MATLAB code allows a user to select between a block, cylinder, or cone shape. It then prompts the user to input the relevant dimensions and calculates the surface area and volume, displaying the results. Based on the input shape, it uses the appropriate formulas to determine the surface area (Lp) and volume (V) and outputs these values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

%MATLAB Programming %tugas - 1 %kelas: EL - 2F %by: Rahmat P Siagian %NIM: 1605033012 %pemograman Komputer

This MATLAB code allows a user to select between a block, cylinder, or cone shape. It then prompts the user to input the relevant dimensions and calculates the surface area and volume, displaying the results. Based on the input shape, it uses the appropriate formulas to determine the surface area (Lp) and volume (V) and outputs these values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

%MATLAB Programming

%Tugas_1
%kelas : EL - 2F
%by : RAHMAT P SIAGIAN
%NIM : 1605033012
%PEMOGRAMAN KOMPUTER

clear all;
clc;

disp('Program Hitung Volume dan Luas Permukaan Bangun Ruang');

disp('Pilihan Bangun Ruang:');


disp('1.Balok');
disp('2.Tabung');
disp('3.Kerucut');

p=input('Masukkan Pilihan=');

switch p
case 1
p=input('Panjang =');
l=input('Lebar =');
t=input('Tinggi =');
Lp = 2*(p*l + p*t + l*t);
V = p*l*t;
disp(['Lp =',num2str(Lp)]);
disp(['V =',num2str(V)]);

case 2
r=input('jari-jari =');
t=input('tinggi=');
Lp = (3.14*r*r*t);
V = (3.14*r*r*t);
disp(['Lp =',num2str(Lp)]);
disp(['V =',num2str(V)]);

case 3
r=input('jari-jari =');
t=input('tinggi =');
s = sqrt(r^2+t^2);
disp(['selimut =',num2str(s)]);
Lp = (3.14*r*r+3.14*r*s);
V = (1/3*3.14*r*r*t);
disp(['Lp =',num2str(Lp)]);
disp(['V =',num2str(V)]);

end

You might also like