Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Finding Maximum Value
Author:
Joven M. Muana
E-mail:
Click to e-mail author
Submitted:
4/17/2007
Version:
VB6
Compatibility:
VB6
Category:
Mathematics
Views:
64618
This code will show you how your going to find and display the maximum value in your array.
Declarations:
'You will need a FORM and a command button Option Explicit Dim A(20), num, i, j, max As Integer
Code:
Private Sub Command1_Click() Print "Your array contains:" For i = 0 To num - 1 Print A(i) Next i Print "Maximum Value= "; max End Sub Private Sub Form_Load() num = InputBox("Initialize your array [1-20]:") For i = 0 To num - 1 A(i) = InputBox("Enter your array:") Next i 'find maximum max = A(0) For i = 0 To num - 1 If max < A(i) Then max = A(i) End If Next End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement