Penggunaan Case Of pada bangun ruang

program bangun_ruang;
uses wincrt;
const Pi=22/7;
var
x

:integer;

a,b,c

:real;

L1,L2,L3,V

:real;

begin
writeln('

------------------------------------');

writeln('

------- P I L I H A N ------');

writeln('

------------------------------------');

writeln('

1. Tabung');

writeln('

2. Balok');

writeln('

3. Prisma');

writeln('

4. Limas segi empat beraturan');

writeln('

------------------------------------');

write('jadi pilihan anda:');
readln(x);
writeln;
writeln;

case x of
1: Begin
writeln('--------------------------------------');
writeln('

T A B U N G');

writeln('--------------------------------------');
writeln;
write('Masukkan diameter tabung: ');
readln(a);
write('Masukkan tinggi tabung : ');
readln(b);
writeln;
writeln('Maka :');
L1:=Pi*a*b;
writeln('Luas selimut tabung adalah: ',L1:0:2);
L2:=Pi*sqr(a/2);
writeln('Luas alas tabung adalah : ',L2:0:2);
V:=L2*b;
writeln('Volume tabung adalah

: ',V:0:2);

L3:=L1+(2*L2);
writeln('Luas tabung adalah

: ',L3:0:2);

writeln('--------------------------------------');

end;
2: Begin
writeln('--------------------------------------');
writeln('

B A L O K');

writeln('--------------------------------------');
writeln;
write('Masukkan panjang balok: ');
readln(a);
write('Masukkan tinggi balok : ');
readln(b);
write('Masukkan lebar balok : ');
readln(c);
writeln;
writeln('Maka :');
L1:=(2*a*b)+(2*b*c)+(2*a*c);
writeln('Luas balok adalah : ',L1:0:2);
V:=a*b*c;
writeln('Volume balok adalah: ',V:0:2);
L3:=4*a+4*b+4*c;
writeln('Panjang semua rusuk adalah:',L3:0:2);
writeln('--------------------------------------');

end;
3: Begin
writeln('--------------------------------------');
writeln('

P R I S M A ');

writeln('--------------------------------------');
writeln;
writeln('Masukkan ');

writeln('--------------------------------------');
end;
4: Begin
writeln('--------------------------------------');
writeln('

L I M A S ');

writeln('--------------------------------------');
writeln;
writeln('Masukkan ');
writeln('--------------------------------------');
end;
end;

if x>4 then
writeln('maaf,,menu pilihan yang anda masukkan salah')
else
writeln('maaf,,menu pilihan yang anda masukkan salah..');
end.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.