Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Bitwise-operations/C-sharp/bitwise-operations.cs
Normal file
14
Task/Bitwise-operations/C-sharp/bitwise-operations.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
static void bitwise(int a, int b)
|
||||
{
|
||||
Console.WriteLine("a and b is {0}", a & b);
|
||||
Console.WriteLine("a or b is {0}", a | b);
|
||||
Console.WriteLine("a xor b is {0}", a ^ b);
|
||||
Console.WriteLine("not a is {0}", ~a);
|
||||
Console.WriteLine("a lshift b is {0}", a << b);
|
||||
Console.WriteLine("a arshift b is {0}", a >> b); // When the left operand of the >> operator is of a signed integral type,
|
||||
// the operator performs an arithmetic shift right
|
||||
uint c = (uint)a;
|
||||
Console.WriteLine("c rshift b is {0}", c >> b); // When the left operand of the >> operator is of an unsigned integral type,
|
||||
// the operator performs a logical shift right
|
||||
// there are no rotation operators in C#
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue