Latihan Kode Pascal:
uses crt;
label 10;
var
nama,npm,kelas:string;
a,b,c,p,l,t,m,n:integer;
K,V:real;
begin
10:
clrscr;
writeln;
writeln('UJIAN LAB PASCAL DASAR');
writeln;
writeln('MENU :');
writeln;
writeln('1.Biodataku');
writeln;
writeln('2.(-) Keliling Balok');
writeln;
writeln('3.(-) Volume Balok');
writeln;
writeln('4.(A) Deret');
writeln;
writeln('5.(B) Deret');
writeln;
writeln('6.Exit');
writeln;
write('Silahkan Memilih: ':25);
readln(c);
case c of
1:begin
clrscr;
writeln('BIODATA':15);
writeln;
write('NAMA',': ':5);readln(nama);
writeln;
write('KELAS',': ':4);readln(kelas);
writeln;
write('NPM',': ':6);readln(npm);
writeln;
writeln('NAMA SAYA',': ':5,nama);
writeln;
writeln('KELAS SAYA',': ':4,kelas);
writeln;
writeln('NPM SAYA',': ':6,npm);
readln;
goto 10;
end;
2:begin
clrscr;
writeln('KELILING BALOK');
writeln;
write('MASUKKAN PANJANG',': ':5);readln(p);
writeln;
write('MASUKKAN LEBAR',': ':7);readln(l);
writeln;
K:=2*(p+l);
write('KELILING BALOK','= ':7,K:5:2);
readln;
goto 10;
end;
3:begin
clrscr;
writeln('VOLUME BALOK');
writeln;
write('MASUKKAN PANJANG',': ':5);readln(p);
writeln;
write('MASUKKAN LEBAR',': ':7);readln(l);
writeln;
write('MASUKKAN TINGGI',': ':6);readln(t);
writeln;
V:=p*l*t;
write('VOLUME BALOK','= ':9,V:6:2);
readln;
goto 10;
end;
4:begin
clrscr;
for a:=1 to 3 do
begin
for b:=1 to a do
write(b);
writeln;
end;
for m:=3 downto 1 do
begin
for n:=1 to m-1 do
write(n);
writeln;
end;
readln;
goto 10;
end;
5:begin
clrscr;
for a:=3 downto 1 do
begin
for b:=1 to a do
write(b);
writeln;
end;
for m:=2 to 3 do
begin
for n:=1 to m do
write(n);
writeln;
end;
readln;
goto 10;
end;
6:end;
end.
Jumat, 18 September 2009
Latihan Pascal
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar