KDU5 uloha č.1

uses crt;
const n=20;
var a:array[1..n] of integer;
i,x,y:byte;
procedure generuj;
begin
randomize;
for i:=1 to n do
begin
a[i]:=random(100);
if random(2)=1 then a[i]:=-a[i];
end;
end;
procedure vypis;
begin
x:=1;y:=1;
for i:=1 to n do
begin
if a[i]>0 then textcolor(red)
else textcolor(green);
if (i mod 2)=1 then y:=1
else y:=2;
gotoxy(x,y);
write(a[i]:3);
inc(x,3);
end;
end;
begin
clrscr;
generuj;
vypis;
readln
end.
const n=20;
var a:array[1..n] of integer;
i,x,y:byte;
procedure generuj;
begin
randomize;
for i:=1 to n do
begin
a[i]:=random(100);
if random(2)=1 then a[i]:=-a[i];
end;
end;
procedure vypis;
begin
x:=1;y:=1;
for i:=1 to n do
begin
if a[i]>0 then textcolor(red)
else textcolor(green);
if (i mod 2)=1 then y:=1
else y:=2;
gotoxy(x,y);
write(a[i]:3);
inc(x,3);
end;
end;
begin
clrscr;
generuj;
vypis;
readln
end.