Android Practical 16

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Recursion:

Public Class Form1


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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy