👤

Se dă un tablou cu 20 componente reale. Elaborați un program, care înlocueşte toate componentele pozitive cu dublul lor, iar cele negative-cu zero. Afişaţi componentele tabloului modificat.
Vă rog frumos


Răspuns :

var a:array[1..20] of real;
i:byte;

begin

for i:=1 to 20 do begin
read(a[i]);
if a[i]<0 then a[i]:=0
else a[i]:=2*a[i];
end;

writeln;

for i:=1 to 20 do write(a[i],' ');

end.