3
22/10/2024 2:42 오후
주제 스타터
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.
Examples:
1개 답글
2
22/10/2024 2:44 오후
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); } }