Online: 13578
Bitwise operator:
A bitwise operator is an operator used to perform bitwise operations on bit patterns or binary numerals that involve the manipulation of individual bits. The c# supports some of the following bitwise operators that are given below.
Some of the bitwise operators which we are using in this program are
1. ~ (Not operation)
2. & (And operation)
3. | (OR operation)
4. ^ (Exclusive OR operation)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
static void Main()
{
int a = 5;
int b = 10;
Console.WriteLine(~a);
Console.WriteLine(a & b);
Console.WriteLine(a | b);
Console.WriteLine(a ^ b);
}
}
In the above code snippet we are performing bitwise operations .
output