Переведите программу в Free Pascal var A: Array [1..100] of integer; size: integer; Even: integer; notEven: integer; begin Write('Set size A :'); Read(size); for i:integer := 1 to ...

Переведите программу в Free Pascal var A: Array [1..100] of integer; size: integer; Even: integer; notEven: integer; begin Write('Set size A :'); Read(size); for i:integer := 1 to size do begin Write('Set A[', i, ']: '); Read(A[i]); end; for i:integer := 1 to size do begin if (A[i] mod 2 <> 0) then begin notEven += A[i]; end else begin Even += A[i]; end; end; Write('Sum even numbers = ', Even); Writeln; Write('Sum notEven numbers = ', notEven); end.
Гость
Ответ(ы) на вопрос:
Гость
Если Вы имели в виду "подогнать" под Free Pascal, то так: varA: Array [1..100] of integer;size,Even,notEven,i: integer; beginWrite('Set size A :');Read(size); for i := 1 to size do beginWrite('Set A[', i, ']: ');Read(A[i]);end; for i := 1 to size do beginif (A[i] mod 2 <> 0) then beginnotEven += A[i];endelse beginEven += A[i];end;end; Write('Sum even numbers = ', Even);Writeln;Write('Sum notEven numbers = ', notEven);end.
Гость
var A: Array [1..100] of integer; size: integer; Even: integer; notEven: integer; i:integer; begin Write('Set size A :'); Read(size); for i:= 1 to size do begin Write('Set A[', i, ']: '); Read(A[i]); end; for i:= 1 to size do begin if (A[i] mod 2 <> 0) then begin notEven += A[i]; end else begin Even += A[i]; end; end; Write('Sum even numbers = ', Even); Writeln; Write('Sum notEven numbers = ', notEven); end.
Не нашли ответ?
Ответить на вопрос
Похожие вопросы