Bit operator
using System;
class Operators {
static void Main() {
int a = 10, b = 15, c = 20, d, e, h, i;
bool f, g, j = (a == b), k;
d = (a & b);
e = (a | b);
f = (j && (b == c));
g = (j || (b == c));
h = (a ^ b);
i = ~b;
k = !j;
Console.WriteLine("{0}", d); //10
Console.WriteLine("{0}", e); //15
Console.WriteLine("{0}", f); //False
Console.WriteLine("{0}", g); //False
Console.WriteLine("{0}", h); //5
Console.WriteLine("{0}", i); //-16
Console.WriteLine("{0}", j); //False
Console.WriteLine("{0}", k); //True
}
}
Related examples in the same category