Подсчитать количество положительных чисел до первого нулевого значения.
Оператор while и repeat
Паскаль
Ответы на вопрос
Ответил nevmensik
0
Ответ:function count_positives(arr: array of integer): integer;
var
i: integer;
count: integer;
begin
i := 0;
count := 0;
while (i <= High(arr)) and (arr[i] <> 0) do begin
if arr[i] > 0 then
count := count + 1;
i := i + 1;
end;
count_positives := count;
end;
Новые вопросы