Ini source codenya :
uses wincrt;
var
i,j,n : integer;
lagi:char;
begin
repeat
clrscr;
writeln('------------------------------');
writeln(' program mencetak huruf D ');
writeln('------------------------------');
writeln;
write('Masukkan angka : ');readln(n);
writeln;
writeln('Hasilnya : ');
writeln;
for i:= 1 to n-2 do
begin
write('*');
end;
writeln;
for j:=1 to 1 do
begin
write('*');
end;
for j:=2 to n-2 do
begin
write(' ');
end;
writeln('*');
for i:=1 to n-4 do
begin
for j:=1 to 1 do
begin
write('*');
end;
for j:=2 to n-1 do
begin
write(' ');
end;
writeln('*');
end;
for j:=1 to 1 do
begin
write('*');
end;
for j:=2 to n-2 do
begin
write(' ');
end;
writeln('*');
for i:=1 to n-2 do
begin
write('*');
end;
writeln;
write('Ulangi ? (y/t) : ');readln(lagi);
until (lagi='t') or (lagi='T');
donewincrt;
end.
Running program :
uses wincrt;
var
i,j,n : integer;
lagi:char;
begin
repeat
clrscr;
writeln('------------------------------');
writeln(' program mencetak huruf D ');
writeln('------------------------------');
writeln;
write('Masukkan angka : ');readln(n);
writeln;
writeln('Hasilnya : ');
writeln;
for i:= 1 to n-2 do
begin
write('*');
end;
writeln;
for j:=1 to 1 do
begin
write('*');
end;
for j:=2 to n-2 do
begin
write(' ');
end;
writeln('*');
for i:=1 to n-4 do
begin
for j:=1 to 1 do
begin
write('*');
end;
for j:=2 to n-1 do
begin
write(' ');
end;
writeln('*');
end;
for j:=1 to 1 do
begin
write('*');
end;
for j:=2 to n-2 do
begin
write(' ');
end;
writeln('*');
for i:=1 to n-2 do
begin
write('*');
end;
writeln;
write('Ulangi ? (y/t) : ');readln(lagi);
until (lagi='t') or (lagi='T');
donewincrt;
end.
Running program :
0 comments:
Posting Komentar