Jawab :
Perulangan Repeat-Until
uses crt;
var
i : integer;
begin
clrscr;
writeln(' PERULANGAN REPEAT-UNTIL ');
writeln('-------------------------');
writeln;
i:=15;
repeat
begin
if i mod 2 = 1 then
write(i:3);
i:=i-1;
end;
until i<=1;
readln;
end.
Hasil:
Perulangan While
uses crt;
var
i : integer;
begin
clrscr;
writeln(' PERULANGAN WHILE ');
writeln('--------------------------');
writeln;
i:=15;
while i>= 1 do
begin
if i mod 2 = 1 then
write(i:3);
i:=i-1;
end;
readln;
end.
Hasil:
Perulangan For
uses crt;
var
i : integer;
begin
clrscr;
writeln(' PERULANGAN FOR ');
writeln('-------------------------');
writeln;
for i:= 15 downto 1 do
begin
if i mod 2 = 1 then
write(i:3);
end;
readln;
end.
Hasil:
Jawab :
uses crt;
var
merosot,kedalaman,selisih : real;
naik,hari : integer;
begin
clrscr;
write('Masukkan Jumlah Kedalaman Sumur = ');readln(kedalaman);
writeln('------------------------------------------------------ --');
writeln('Jumlah Hari Naik Merosot Jumlah Naik Kedalaman');
writeln(' Per Hari');
writeln('------------------------------------------------------ --');
hari := 1;
naik := 3;
merosot := 1;
selisih := naik - merosot;
while kedalaman > 0 do
begin
kedalaman := kedalaman - selisih;
writeln(hari:7, naik:10, merosot:10:2, selisih:11:2, kedalaman:14:2);
hari := hari + 1;
if (hari>5) and (hari<=15) then
begin
naik := 2;
merosot := 1.25;
selisih := naik - merosot;
end
else if (hari>15) then
begin
naik := 2;
merosot := 1.5;
selisih := naik - merosot;
end;
end;
readln;
end.
Hasil:
trima kasih atas post nya :)
BalasHapusありがとうございます >.<
BalasHapusTenk semoga bermanfaat ilmunya,N di tunggu ilmu dan pemahaman Agan yang lain,jangan lupa POSTING ...
BalasHapusH3h3
BalasHapus