Professional Documents
Culture Documents
(Varianta 6 bac)
Exemeplu
Codul:
Public Class Form1
Dim n As Integer
Dim A(100) As Integer
Dim i As Integer
Dim j As Integer
Dim B(100) As Integer
Dim x As Integer
Dim y As Integer
Dim nr1 As Integer
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
n = nr.Text
x = InputBox("Numarul 1")
nr1 = 1
j = 1
For i = 1 To n - 1
y = InputBox("Numarul " + Str(i + 1))
If (x = y) Then
nr1 = nr1 + 1
Else
B(j) = x
B(j + 1) = nr1
j = j + 2
x = y
nr1 = 1
End If
If (x = y) Then
B(j) = x
B(j + 1) = nr1
End If
Next
End Sub
trb2.AppendText(Environment.NewLine)
Next
End Sub
End Class