var k, i: integer;
A: array[1..20] of integer;
begin
k := 1;
for i:= 1 to 20 do begin
A[i] := k + 7;
k := k + 2;
end;
write(A[i], ' ');
end.
Объяснение:
Программа:
Pascal:
var
K: integer;
K := 1;
for var i := 1 to 20 do begin
A[i] := K + 7;
inc(K, 2);
writeln(A);
Результат:
[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46]
var k, i: integer;
A: array[1..20] of integer;
begin
k := 1;
for i:= 1 to 20 do begin
A[i] := k + 7;
k := k + 2;
end;
for i:= 1 to 20 do begin
write(A[i], ' ');
end;
end.
Объяснение:
Программа:
Pascal:
var
A: array[1..20] of integer;
K: integer;
begin
K := 1;
for var i := 1 to 20 do begin
A[i] := K + 7;
inc(K, 2);
end;
writeln(A);
end.
Результат:
[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46]