Given a 2 dim array write a VB PROGRAM that will add all odd numbers greater than 3. This is my solution but am not that sure so assist me.

if( number % 2 == 1)
____number is odd
else
____number is even

so checking if it's odd and greater than 3 goes like this:
if(number%2==1 && number>3)

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by bojofien

Dear betty_vaness,

Continuing is the solution to your requirement.

Deseandote very successful.

bojofien

``````Sub NumerosImpares ()
'
'NumerosImpares Macro
'

'
Dim f, c, i, j As Integer
Dim MatrizI () As Integer

'DimensiĆ³n de Matriz. Determina la Cantidad de filas de columnas y

'Numeros impares mayores a 3
i = 4
Para f = 0 To (fil_cantidad - 1)
Para c = 0 To (col_cantidad - 1)
j = 1
Do While (j <> 0 And i> 3)
j = (i mod 2)
i = i + 1
Loop
MatrizI (f, c) = i
MsgBox MatrizI (f, c),
Siguiente
Siguiente

End Sub``````

Edited by bojofien: n/a

Dear betty_vaness,

Continuing is the solution to your requirement.

Deseandote very successful.

bojofien

``````Sub MatrizImpares()
'
'NumerosImpares Macro
'

'
Dim f, c, i, j As Integer
Dim MatrizI() As Integer

'DimensiĆ³n de Matriz. Determina la Cantidad de filas de columnas y

' Redimensionar dimensiones de la Matriz

'Numeros impares mayores a 3
i = 4
For f = 0 To (fil_cantidad - 1)
For c = 0 To (col_cantidad - 1)
j = 1
Do While (j <> 0 And i > 3)
j = (i Mod 2)
i = i + 1
Loop
MatrizI(f, c) = i
MsgBox MatrizI(f, c)
Next
Next
Else
MsgBox "Error! Dimensiones no definidas"
End If
'  End of Sub
End Sub``````
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.