You are on page 1of 2

5.Se da un vector.Sa se afiseze maximul din acesta.

Codul sursa este urmatorul:


Public Class Form1
Dim n As Integer
Dim v(100) As Integer
Dim i As Integer
Dim nr As Integer
Dim max As Integer

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


n = TextBox1.Text
For i = 1 To n
v(i) = InputBox("Introduceti valoarea " + Str(i))
Next
max = v(1)
For i = 2 To n
If v(i) > max Then
max = v(i)

End If
Next

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


RichTextBox1.AppendText("valoarea maxima este " + Str(max))
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub
End Class

You might also like