soal 2
uses crt;
var
i,j,k : byte;
begin
clrscr;
write('Masukan angka = '); readln(k);
for i := k downto 1 do
begin
textcolor(j);
for j := i downto 1 do
write(j,' ');
writeln;
end;
readln;
end.
soal 3
uses crt;
var
i,j,k,l,m : byte;
begin
clrscr;
write('Masukan Jumlah Ayam (10) = '); readln(j);
writeln;
textcolor(j);
repeat
i:=j-1;
writeln('10 ayam mati 1 tinggal',' ',i);
until i<10;
repeat
k:=i-2;
writeln('9 ayam mati 2 tinggal',' ',k);
until k<9 ;
repeat
l:=k-3;
writeln('7 ayam mati 3 tinggal',' ',l);
until l<7 ;
repeat
m:=l-4;
writeln('4 ayam mati 4 tinggal',' ',m);
until m<4 ;
readln;
end.
uses crt;
var
i,j,k : byte;
begin
clrscr;
write('Masukan angka = '); readln(k);
for i := k downto 1 do
begin
textcolor(j);
for j := i downto 1 do
write(j,' ');
writeln;
end;
readln;
end.
soal 3
uses crt;
var
i,j,k,l,m : byte;
begin
clrscr;
write('Masukan Jumlah Ayam (10) = '); readln(j);
writeln;
textcolor(j);
repeat
i:=j-1;
writeln('10 ayam mati 1 tinggal',' ',i);
until i<10;
repeat
k:=i-2;
writeln('9 ayam mati 2 tinggal',' ',k);
until k<9 ;
repeat
l:=k-3;
writeln('7 ayam mati 3 tinggal',' ',l);
until l<7 ;
repeat
m:=l-4;
writeln('4 ayam mati 4 tinggal',' ',m);
until m<4 ;
readln;
end.