cari ajah disini

Minggu, 21 Maret 2010

tugas pascal 1-5 bu marliza

FOR...DOWNTO...DO

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

REPEAT..UNTIL..

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

FOR ...TO...DO..

uses crt;
var x,n,y : integer;
begin
clrscr;
for x := 1 to n do
begin
for y := 1 to x do
begin
write(y);
end;
writeln;
end
readln;
end.




IF...THEN...

uses crt;
var
a : integer;
b : string;
begin
clrscr;
write ('Masukkan Nilai anda : ');readln(a);
if a >= 70 then
writeln('bagus')
readln;
end.

WHILE..DO..BEGIN

uses crt;
var a: integer;
begin
clrscr;
a :=0;
while(a <=5) do begin
writeln( A);
A :=A+1;
readln;
end;
end.


WHILE..DO
uses crt;
begin
a : integer;
begin;
clrscr;
a := 1;
while a <= 20 do
begin
write(a);
digit:= a +1;
readln;
end;
end.

CASE ...OF

uses crt;
var
menu :char;
begin;
clrscr;
writeln('=====menu=====');
writeln('1.menu 1');
writeln('2.menu 2');
writeln('exit');
write('masukkan pilihan anda = ');readln(menu);
case menu of
1:begin
clrscr;
writeln('menu 1');
end;
2:begin
clrscr;
writeln('menu 2');
end;
3:begin
clrscr;
writeln('exit');
end;
readln;
end.
end;
readln;

Tidak ada komentar:

Posting Komentar