23
1
using System;
2
3
public class BitwWiseProgram
4
{
5
public static void Main()
6
{
7
int FirstValue = 10;
8
int SecondValue = 20;
9
int result;
10
result = ~FirstValue;
11
Console.WriteLine("~{0} = {1}", FirstValue, result);
12
result = FirstValue & SecondValue;
13
Console.WriteLine("{0} & {1} = {2}", FirstValue,SecondValue, result);
14
result = FirstValue | SecondValue;
15
Console.WriteLine("{0} | {1} = {2}", FirstValue,SecondValue, result);
16
result = FirstValue ^ SecondValue;
17
Console.WriteLine("{0} ^ {1} = {2}", FirstValue,SecondValue, result);
18
result = FirstValue << 2;
19
Console.WriteLine("{0} << 2 = {1}", FirstValue, result);
20
result = FirstValue >> 2;
21
Console.WriteLine("{0} >> 2 = {1}", FirstValue, result);
22
}
23
}
Cached Result