2) Ввести в память машины двухмерный массив A(M,N). Найти сумму элементов в каждой строке, т.е получить одновременый массив C(M)








[/b]
Const N as long = <установить...>
Const M as long = <установить...>
Dim i as long, j as long, count as long
Sub Main()
dim A() as Long
dim C() as long
' Пункт 1:
redim A(N-1)
for i = 0 to n-1
A(i) = CLng(Val(InputBox("Введите элемент #" & (i+1))))
next
for i = 0 to n-1
if A(i) < 0 then count = count + 1
next
MsgBox "Число отрицательных элементов = " & count
' Пункт 2:
redim A(M-1, N-1)
redim C(M-1)
for i = 0 to m-1
for j = 0 to n-1
A(i,j) = CLng(Val(InputBox("Введите элемент #" & (i+1) & "." (j+1))))
next
next
for i = 0 to m-1
count = 0
for j = 0 to n-1
count = count + a(i,j)
next
C(i) = count
next
end sub
Dim N As Long, I As Long, C As Long
Input N
Dim A(N) As Long
For I = 1 To N
Input A(I - 1)
If A(I - 1) < 0 Then C = C + 1
Next
Print C
Dim M As Long, N As Long, I As Long, J As Long
Input M, N
Dim A(M, N) As Long: Dim C(N) As Long
For I = 1 To N
For J = 1 To M
Input A(J, I)
Next
Next
For I = 0 To N - 1
For J = 0 To M - 1
C(I) = C(I) + A(J, I)
Next
Next
For I = 0 To N - 1
Print C(I)
Next
Сейчас этот форум просматривают: AhrefsBot, Google-бот, Yandex-бот и гости: 71