Tugas Pascal 1 - 5

5:30 AM
FOR ... DOWNTO ... DO

uses crt;
var
a: integer;
begin
clrscr;
for a := 5 downto 1 do
begin
writeln (a);
end;
readln;
end.
=========================

REPEAT ... UNTIL

uses crt;
var
nilai : integer;
begin
clrscr;
nilai:=1;
repeat
writeln (nilai);
nilai:= nilai +1;
until nilai > 20;
readln;
end.
=========================

FOR ... TO ... DO

uses crt;
var
x : integer;
begin
clrscr;
for x := 1 to 5 do
begin
writeln ('1KA22');
end;
readln;
end.

=========================

FOR ... TO ... DO

uses crt;
var
a,b,c,d,e : integer ;
begin
clrscr ;
write ('masukkan angka : '); readln (a);
for b := 1 to a do
begin
for c := 1 to b do
begin
write (c);
end;
writeln;
end;
for d := a downto 1 do
begin
for e := 1 to (d-1) do
begin
write (e);
end;
writeln;
end;
readln;
end.
=========================

IF ... THEN

uses crt;
var
nilai : integer;
hasil : string;
begin
clrscr;
hasil = 'tidak lulus';
write ('Masukkan Nilai anda : ');readln(nilai);
if nilai >= 70 then
hasil = 'Lulus';
writeln (hasil);;
readln;
end.
=========================

WHILE ... DO

uses crt;
var b : integer;
begin
clrscr;
b:=1;
while(b<=5) do begin writeln('ok ', b); b:=b+1; end; readln; end. =========================
WHILE..DO


USES CRT;
VAR DIGIT : INTEGER;
begin;
clrscr;
digit := 1;
while digit <= 20 do begin write(digit); digit:= digit +1; end; readln; end. =========================
CASE ...OF


uses crt;
var hadiah :integer;
begin;
clrscr;
write('Masukkan kode hadiah [1/2/3] : '); readln(hadiah);
case hadiah of
1 :writeln('Komputer');
2 :writeln('Playstation2');
3 :writeln('Playstation1');
end;
readln;
end.
=========================

Artikel Terkait

Previous
Next Post »

COMMENT BOX EmoticonEmoticon