Masukkan kode berikut:
program diamond; uses crt; const max=5; var i,j,k:integer; begin clrscr; for i:=1 to max do begin for j:=max downto 1 do begin if j<=i then write('*') else write(' '); end; for k:=1 to i do write('*'); writeln; end; for i:=max downto 1 do begin for j:=max downto 1 do begin if j<=i then write('*') else write(' '); end; for k:=1 to i do write('*'); end; readln; end.
*Jika menghadapi kesalahan atau pertanyaan dengan program di atas. Harap komen di bawah.
Thanks sob...
You made 1 mistake while writing the second part of the diamond, I mean
for i:=max downto 1 do begin
for j:=max downto 1 do begin
if j<=i then write('*')
else write(' ');
end;
for k:=1 to i do write('*');
writeln; <----------- This one!!!
end;
You forgot the Writeln; :)