Assalamu'alikum wr.wb
Perulangan pascal dengan while do sebagai contoh program bintang
1. Baris Program
Program Bintang;
Uses Crt;
Var
a,b:Integer;
Begin
Clrscr;
b:=1;
Write('Masukan Tinggi Segitiga:' );
Readln(a);
While b<=a do
Begin
For b:= 1 to b do
begin
Write('*');
end;
b:=b+1;
Writeln('');
end;
Writeln('');
Readln;
End.
Output:
Perulangan pascal dengan while do sebagai contoh program bintang
1. Baris Program
Program Bintang;
Uses Crt;
Var
a,b:Integer;
Begin
Clrscr;
b:=1;
Write('Masukan Tinggi Segitiga:' );
Readln(a);
While b<=a do
Begin
For b:= 1 to b do
begin
Write('*');
end;
b:=b+1;
Writeln('');
end;
Writeln('');
Readln;
End.
Output:
2. Baris Program
Program Bintang;
Uses Crt;
Var
a,b:Integer;
Begin
Clrscr;
b:=5;
Write('Masukan Tinggi Segitiga:' );
Readln(a);
While b>= 1 do
Begin
For a:= b downto 1 do
begin
Write('*');
end;
b:=b-1;
Writeln('');
end;
Readln;
End.
Output:
Wassalamu'alikum wr.wb.
Ijin copas buat latihan,,,
ReplyDelete