VB.Net Program to Check the Given Number Is Even or Odd Using Conditional Operator

You are currently viewing VB.Net Program to Check the Given Number Is Even or Odd Using Conditional Operator

VB.Net program to check the given number is EVEN or ODD using conditional operator

'VB.Net program to check given number is 
'EVEN or ODD using conditional operator.

Module Module1

    Sub Main()

        Dim result As String
        Dim num As Integer = 0

        Console.Write("Enter number: ")
        num = Integer.Parse(Console.ReadLine())

        result = If((num Mod 2 = 0), "Number is EVEN", "Number is ODD")

        Console.WriteLine(result)

        Console.ReadLine()
    End Sub

End Module

Output

Enter number: 5
Number is ODD

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