VB.net Program to Demonstrate the Dividebyzeroexception

You are currently viewing VB.net Program to Demonstrate the Dividebyzeroexception

VB.Net program to demonstrate the DivideByZeroException

'Vb.Net program to demonstrate the DivideByZeroException.

Module Module1
    Sub Main()
        Dim num1 As Integer = 10
        Dim num2 As Integer = 0
        Dim num3 As Integer = 0

        Try
            num3 = num1 \ num2
            Console.WriteLine("Result is: {0}", num3)
        Catch e As DivideByZeroException
            Console.WriteLine(e.Message)
        End Try
    End Sub
End Module
Attempted to divide by zero.
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply