Дан массив целых чисел А(10). Все нечетные элементы удвоить.
const n = 10;var a: array[1..n] of integer; i: byte;begin for i := 1 to n do begin a[i] := random(20); write(a[i], ' '); end; writeln; for i := 1 to n do begin if(a[i] mod 2 <> 0) then a[i] := a[i] * 2; write(a[i], ' '); end;end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const n = 10;
var
a: array[1..n] of integer;
i: byte;
begin
for i := 1 to n do begin
a[i] := random(20);
write(a[i], ' ');
end;
writeln;
for i := 1 to n do begin
if(a[i] mod 2 <> 0) then a[i] := a[i] * 2;
write(a[i], ' ');
end;
end.