Sunday, 11 October 2009

PROGRAM MENU PADA PASCAL

PROGRAM MENU PADA PASCAL

uses crt;
const
Phi = 3.14;
var
nilai : integer;
r,Luas : real;
L, A, T : real;
angka, I, J : integer;

begin
clrscr;
writeln('-------MENU-------');
writeln('1. Luas Lingkaran');
writeln('2. Luas Segitiga ');
writeln('3. Deret Segitiga ');
writeln('------------------');
write('Masukkan Angka Anda : '); read(nilai);

case nilai of
1 : begin
clrscr;
writeln('Luas Lingkaran');
write('r : ');read(r);
Luas := Phi * r*r;
writeln(Luas);
writeln;
end;

2 : begin
clrscr;
writeln('Luas Segitiga');
write('Alas = ');read(A);
write('Tinggi = ');read(T);
L := (A * T) / 2;
writeln(L);
writeln;
end;

3 : begin
clrscr;
writeln('Deret Segitiga');
write('Masukkan Jumlah Deret : ');readln(angka);
begin
for I := 1 to angka do
begin
for J := 1 to I do
write(J);
writeln;
end;
end;readln;
begin
for I := angka downto 1 do
begin
for J := 1 to I do
write(J);
writeln;
end;
end;

end;
end;
repeat Until Keypressed
end.

Posting Terkait

0 comments:

Post a Comment

Mikail Alfith Amarullah

↑ Grab this Headline Animator

IKLAN

  © Blogger Tamplates

Back to TOP