The document contains code for two functions: 1) A recursive function f_rec() that displays a increasing count from 1 to 10 using recursion. 2) Functions Larg() and small() that take in 3 numbers as parameters and return the maximum and minimum numbers respectively by comparing the values.
The document contains code for two functions: 1) A recursive function f_rec() that displays a increasing count from 1 to 10 using recursion. 2) Functions Larg() and small() that take in 3 numbers as parameters and return the maximum and minimum numbers respectively by comparing the values.
The document contains code for two functions: 1) A recursive function f_rec() that displays a increasing count from 1 to 10 using recursion. 2) Functions Larg() and small() that take in 3 numbers as parameters and return the maximum and minimum numbers respectively by comparing the values.
The document contains code for two functions: 1) A recursive function f_rec() that displays a increasing count from 1 to 10 using recursion. 2) Functions Larg() and small() that take in 3 numbers as parameters and return the maximum and minimum numbers respectively by comparing the values.
Dim count As Integer Public Function f_rec() MsgBox(count) count += 1 If count <= 10 Then f_rec()
End If End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click count = 1 f_rec() End Sub End Class Maximum Number:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim max As Integer max = Larg(Val(TextBox1.Text), Val(TextBox2.Text), Val(TextBox3.Text)) TextBox4.Text = max End Sub Private Function Larg(ByVal n1 As Integer, ByVal n2 As Integer, ByVal n3 As Integer) Dim m As Integer If n1 > n2 And n2 > n3 Then m = n1 ElseIf n2 > n1 And n2 > n3 Then m = n2 Else m = n3 End If Return m End Function Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim min As Integer min = small(Val(TextBox1.Text), Val(TextBox2.Text), Val(TextBox3.Text)) TextBox4.Text = min End Sub Private Function small(ByVal n1 As Integer, ByVal n2 As Integer, ByVal n3 As Integer) Dim c As Integer If n1 < n2 And n2 < n3 Then c = n1 ElseIf n2 < n1 And n2 < n3 Then c = n2 Else c = n3 End If Return c End Function End Class