• из одномерного числового массива A длинной n получить массив B , заменив все нулевые элементы - единицами. Подсчитать число замен. Вывести на экран массивы A и B и ответ на вопрос задачи

Ответы 2

  • program special;const n=15; var i: integer;A: array [1..n] of integer;B: array [1..n] of integer;beginrandomize;for i:=1 to n do A[i]:=random(5);for i:=1 to n do beginif A[i]=0 then b[i]:=1 else B[i]:=A[i];end;for i:=1 to n do write(A[i],' ');writeln;for i:=1 to n do write(B[i],' ');end.
  • Паскаль:program special;const n=15; var i: integer;A: array [1..n] of integer;B: array [1..n] of integer;beginrandomize;for i:=1 to n do A[i]:=random(5);for i:=1 to n do beginif A[i]=0 then b[i]:=1 else B[i]:=A[i];end;for i:=1 to n do write(A[i],' ');writeln;for i:=1 to n do write(B[i],' ');end.
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years