3
22/10/2024 2:42 pm
Старт на темата
Using bitwise operators, write an expression for finding the value of the bit #3 of a given unsigned integer. The bits are counted from right to left, starting from bit #0. The result of the expression should be either 1 or 0.
Примери:

1 Отговор
2
22/10/2024 2:44 pm
My solution is:
using System;
class BitwiseOperations
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
int p = 3;
int nRightp = n >> p;
int bit = nRightp & 1;
Console.WriteLine(bit);
}
}
