Const n=8; var x : array[1..n] of real; i : integer; min : real; begin Randomize; writeln('Исходный массив:'); for i:=1 to n do begin x[i]:=20*random-10; write(x[i]:6:2,' '); end; writeln; min:=x[1]; for i:=2 to n do if x[i] < min then min:=x[i]; writeln('min=',min:6:2); for i:=1 to n do if x[i]<0 then x[i]:=min; writeln('Измененный массив:'); for i:=1 to n do write(x[i]:6:2,' '); end.
Требуемая процедура Sub ex1(ByRef a() As Integer, ByRef nn As Integer, ByRef nz As Integer) Dim i As Integer nn = 0: nz = 0 For i = 1 To 45 If a(i) = 0 Then nz = nz + 1 Else If a(i) < 0 And i <= 35 Then nn = nn + 1 End If End If Next i End Sub
Процедура для тестирования с выводом на лист Excel Sub Test() Dim p(1 To 45) As Integer Dim n1 As Integer, n2 As Integer, i As Integer Randomize Timer For i = 1 To 45 p(i) = Int(25 * Rnd - 12) Cells(i, 1) = p(i) Next i ex1 p, n1, n2 Cells(1, 2) = n1 Cells(1, 3) = n2 End Sub
ответ находится во вложении