In this program, You will learn How to find the largest digit of a number in VB.Net.

**Write this code for How to find the largest digit of a number in VB.Net?**

[php]

Imports System

Module Program

Sub Main(args As String())

Dim n, r As Integer, digit As Integer = 0

Console.Write("Enter a number:")

n = Convert.ToInt32(Console.ReadLine())

While n > 0

r = n Mod 10

If digit < r Then

digit = r

End If

n = n / 10

End While

Console.WriteLine("Largest digit:" & digit)

Console.ReadLine()

End Sub

End Module

[/php]

**Output :find the largest digit of a number in VB.Net **