berikut merupakan contoh skript pada program turbo pascal untuk looping(pengulangan)
penggunaan for to do
uses wincrt;
var I : integer;
begin
for I:=1 to 5 do
writeln('testing',I);
readln;
end.
penggunaan for downto do
uses wincrt;
var I : integer;
begin
for I:=5 downto 1 do
writeln('testing',I);
readln;
end.
penggunaan repeat until
uses wincrt;
var i : integer;
begin
i:=0;
repeat
i:=i+1;
writeln('testing',i);
until i=5;
readln;
end.
penggunaan while do
uses wincrt;
var I : integer;
begin
clrscr;
while I<=5 do
begin
writeln('testing',I);
I:=I+1;
end;
readln;
end.
selamat mencoba ^^
penggunaan for to do
uses wincrt;
var I : integer;
begin
for I:=1 to 5 do
writeln('testing',I);
readln;
end.
penggunaan for downto do
uses wincrt;
var I : integer;
begin
for I:=5 downto 1 do
writeln('testing',I);
readln;
end.
penggunaan repeat until
uses wincrt;
var i : integer;
begin
i:=0;
repeat
i:=i+1;
writeln('testing',i);
until i=5;
readln;
end.
penggunaan while do
uses wincrt;
var I : integer;
begin
clrscr;
while I<=5 do
begin
writeln('testing',I);
I:=I+1;
end;
readln;
end.
selamat mencoba ^^
numpak yaa klik ni link sapa tw bsa ngebantu cari uang tambahan http://www.emoneybux.com/?ref=thosimg3x
BalasHapus