Rem find the maximum from set of numbers
Dim a(1 To 5, 1 To 5) As Integer
Dim M As Integer, N As Integer, i As Integer, j As Integer,
Dim cpos As Integer
M = InputBox("enter total no of days")
N = InputBox("enter total no of products")
Msgbox("enter total elements")
For i = 1 To M
For j = 1 To N
a(i, j) = InputBox("enter the seed sales value")
Next j
Next i
max = a(1, 1)
rpos = 1
cpos = 1
For i = 1 To M
For j = 1 To N
If (a(i, j) > max) Then
max = a(i, j)
rpos = i
cpos = j
End If
Next j
Next i
Rem output
print "The matrix elements are"
For i = 1 To M
For j = 1 To N
Print a(i, j),
Next j
Print ""
Next i
Print "the maximum product sales is " & Str(max)
Print "the day" & Str(rpos)
Print "the product" & (cpos)
End Sub
No comments:
Post a Comment