ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

VB.Net program to demonstrate the BITWISE NOT operator

Here, we are going to demonstrate the BITWISE NOT in VB.Net.
Submitted by Nidhi, on November 26, 2020

Here, we will use the BITWISE NOT operator to reverse the result of conditions used in the program.

Program/Source Code:

The source code to demonstrate the BITWISE NOT operator is given below. The given program is compiled and executed successfully.

'VB.Net program to demonstrate the 
'"bitwise NOT" operator.

Module Module1

    Sub Main()

        Dim num As Integer = 6

        If Not (num = 6) Then
            Console.Write("Hello")
        Else
            Console.Write("Hiiii")
        End If

        Console.ReadLine()
    End Sub

End Module

Output:

Hiiii

Explanation:

In the above program, we created a module Module1 that contains a function Main(). In the Main() function, we created a variable num with an initial value of 6.

If Not (num = 6) Then
    Console.Write("Hello")
Else
    Console.Write("Hiiii")
End If

In the above code, we compare the value of variable num with 6 for equality that will return TRUE, but because of the bitwise NOT operator it will because FALSE, and then the Else part will be executed and print "Hiiii" message on the console screen.

VB.Net Basic Programs »

ADVERTISEMENT
ADVERTISEMENT




Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.