
Grador
6 год назад
Дана матрица А. Написать программу определения количества положительных и отрицательных элементов матрицы. Язык Visual Basic. ![\left[\begin{array}{ccc}-10&20&13\\-25&1&3\\4&12&-8\end{array}\right] \left[\begin{array}{ccc}-10&20&13\\-25&1&3\\4&12&-8\end{array}\right]](https://tex.z-dn.net/?f = +%5Cleft%5B%5Cbegin%7Barray%7D%7Bccc%7D-10%2620%2613%5C%5C-25%261%263%5C%5C4%2612%26-8%5Cend%7Barray%7D%5Cright%5D+)
ОТВЕТЫ

Эдвардович
Aug 6, 2019
Private Sub Command1_Click()
Dim myArray(3,3) as Integer
Dim count_pos as Integer
Dim cout_neg as Integer
Dim i as Integer
Dim j as Integer
count pos = 0, count_neg = 0
For i = 0 to 3
For j = 0 to 3
If (myArray(i,j) gt; 0) Then
count_pos = count_pos+1
Else if (myArray(i,j) lt; 0) Then
count_neg = count_neg+1
Else
End If
Next j
Next i
MsgBox("Положительных чисел " amp; count_pos amp; " ,а отрицательных " amp; count_neg);
EndSub
Dim myArray(3,3) as Integer
Dim count_pos as Integer
Dim cout_neg as Integer
Dim i as Integer
Dim j as Integer
count pos = 0, count_neg = 0
For i = 0 to 3
For j = 0 to 3
If (myArray(i,j) gt; 0) Then
count_pos = count_pos+1
Else if (myArray(i,j) lt; 0) Then
count_neg = count_neg+1
Else
End If
Next j
Next i
MsgBox("Положительных чисел " amp; count_pos amp; " ,а отрицательных " amp; count_neg);
EndSub
180
Смежные вопросы: