Предмет: Информатика, автор: rekebab

Дана матрица А. Написать программу определения количества положительных и отрицательных элементов матрицы. Язык Visual Basic.   left[begin{array}{ccc}-10&20&13\-25&1&3\4&12&-8end{array}right]

Ответы

Автор ответа: Аноним
0
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) > 0) Then
count_pos = count_pos+1
Else if (myArray(i,j) < 0) Then
count_neg = count_neg+1
Else
End If
Next j
Next i
MsgBox("Положительных чисел " & count_pos & " ,а отрицательных " & count_neg); 
EndSub
Похожие вопросы