FOR ...TO...DO
uses crt;
var
i,j,n: integer;
begin
clrscr;
write('Masukkan Angka: ');readln(n);
for i := 1 to n do
begin
for j := 1 to i do
begin
write(i);
end;
writeln;
end;
readln;
end.
FOR...DOWNTO...DO
uses crt;
var
k,l,n : integer;
begin
clrscr;
write('Masukkan Angka: ');readln(n);
for k := n downto 1 do
begin
for l := 1 to (k-1) do
begin
write(l);
end;
writeln;
end;
readln;
end.
REPEAT..UNTIL
uses crt;
var
a: integer;
begin
clrscr;
a := 1;
repeat
write(a,' ');
a := a + 1;
until a > 20;
readln;
end.
WHILE..DO..BEGIN
uses crt;
var
a: integer;
begin
clrscr;
a :=0;
while(a <=5) do
begin
writeln( A);
A :=A+1;
end;
readln;
end.
WHILE..DO
uses crt;
var
p: integer;
begin
clrscr;
p := 1;
while p <= 20 do
begin
write(p,' ');
p := p + 1;
end;
readln;
end.
CASE ...OF
uses crt;
var
pil :integer;
begin;
clrscr;
writeln('===== MENU =====');
writeln('1: Pilihan 1');
writeln('2: Pilihan 2');
writeln('3: Pilihan 3');
writeln('4: exit');
write('Masukkan pilihan anda = ');readln(pil);
case pil of
1:begin
clrscr;
writeln('Pilihan 1');
readln;
end;
2:begin
clrscr;
writeln('Pilihan 2');
readln;
end;
3:begin
clrscr;
writeln('Pilihan 3');
readln;
end;
4:begin
clrscr;
writeln('EXIT');
readln;
end;
readln;
end.
IF...THEN
uses crt;
var
x : integer;
begin
clrscr;
write ('Masukkan Nilai anda : ');readln(x);
if x >= 75 then
writeln('baik')
readln;
end.
uses crt;
var
i,j,n: integer;
begin
clrscr;
write('Masukkan Angka: ');readln(n);
for i := 1 to n do
begin
for j := 1 to i do
begin
write(i);
end;
writeln;
end;
readln;
end.
FOR...DOWNTO...DO
uses crt;
var
k,l,n : integer;
begin
clrscr;
write('Masukkan Angka: ');readln(n);
for k := n downto 1 do
begin
for l := 1 to (k-1) do
begin
write(l);
end;
writeln;
end;
readln;
end.
REPEAT..UNTIL
uses crt;
var
a: integer;
begin
clrscr;
a := 1;
repeat
write(a,' ');
a := a + 1;
until a > 20;
readln;
end.
WHILE..DO..BEGIN
uses crt;
var
a: integer;
begin
clrscr;
a :=0;
while(a <=5) do
begin
writeln( A);
A :=A+1;
end;
readln;
end.
WHILE..DO
uses crt;
var
p: integer;
begin
clrscr;
p := 1;
while p <= 20 do
begin
write(p,' ');
p := p + 1;
end;
readln;
end.
CASE ...OF
uses crt;
var
pil :integer;
begin;
clrscr;
writeln('===== MENU =====');
writeln('1: Pilihan 1');
writeln('2: Pilihan 2');
writeln('3: Pilihan 3');
writeln('4: exit');
write('Masukkan pilihan anda = ');readln(pil);
case pil of
1:begin
clrscr;
writeln('Pilihan 1');
readln;
end;
2:begin
clrscr;
writeln('Pilihan 2');
readln;
end;
3:begin
clrscr;
writeln('Pilihan 3');
readln;
end;
4:begin
clrscr;
writeln('EXIT');
readln;
end;
readln;
end.
IF...THEN
uses crt;
var
x : integer;
begin
clrscr;
write ('Masukkan Nilai anda : ');readln(x);
if x >= 75 then
writeln('baik')
readln;
end.
kalau contoh program OOP Pascal gimana yaa ?
BalasHapus