uses wincrt;
label akhir,awal;
var menu : integer;
x:char;
procedure lpkubus;
var
s,ls:integer;
begin
clrscr;
writeln('<<<Menghitung Luas Kubus>>>');readln;
write('Masukkan Sisi Kubus : ');readln(s);
ls := 6*s*s;
writeln('Luas Permukaan Kubus = ', ls);
end;
procedure fak;
function Faktorial(a:integer):longint;
begin
if (A=1)then
Faktorial:=1
else
Faktorial:=a*faktorial(a-1);
end;
var x:integer;
begin
clrscr;
writeln('<<<Bilangan Faktorial>>>');readln;
writeln;
write('Berapa Faktorial : ');readln(x);
writeln(x,' faktorial ','= ',faktorial(x));
end;
procedure prim;
var
prima : array [1..100] of integer;
i,k,j,n,pr:integer;
begin
clrscr;
write ('Masukkan Nilai : ');readln(n);
for i:= 1 to n do
begin
k:=0;
for pr:= 1 to i do
begin
j:= i mod pr;
if j = 0 then
k:= k+1;
end;
if k=2 then
write(i, ' ');
end;
writeln;
end;
begin
begin
awal :clrscr;
writeln('<<<MENU>>>');
writeln('1. Bilangan Prima');
writeln('2. Bilangan Faktorial');
writeln('3. Menghitung Luas Kubus');
writeln('0. Selesai');
write('Pilih Menu No : '); read(menu);
end;
case menu of
1: begin
prim;
write('Ingin Kembali Ke Menu Awal ? [y/n] '); read(x);
if x='y' then
goto awal
else
goto akhir;
end;
2: begin
fak;
write('Ingin Kembali Ke Menu Awal ? [y/n] '); read(x);
if x='y' then
goto awal
else
goto akhir;
end;
3: begin
lpkubus;
write('Ingin Kembali Ke Menu Awal ? [y/n] '); read(x);
if x='y' then
goto awal
else
goto akhir;
end;
0: begin
clrscr;
goto akhir;
end;
else;
goto awal;
end;
akhir:
end.
program tersebut akan running pada turbo pascal. :)
mohon maaf bila masih ada yang salah..
uuh ane kga paham gan
BalasHapus