|
zadach51.BAS |
|
{* Задача51 *}REM basic ' Напишите программу суммирования положительных элементов квадратной матрицы, превышающих по' величине среднее арифметическое всех элементов главной диагонали.N = 5
Dim A(1 To N, 1 To N) As Integer
Dim i As Integer
Dim j As Integer
Dim count As Integer
Dim sred As Single
For i = 1 To N
For j = 1 To N
INPUT A(i, j)
Next j
Next i
sred = 0
For i = 1 To N
sred = sred + A(i, i)
Next
count = 0
If sred < 0 Then
sred = 0
End If
For i = 1 To N
For j = 1 To N
If A(i, j) * N > sred Then
count = count + 1
End If
Next j
Next i
PRINT count
End
|