4
22/10/2024 2:40 अपराह्न
विषय प्रारंभकर्ता
Write an expression that extracts from given integer n the value of given bit at index p.
Examples:

1 उत्तर
3
22/10/2024 2:40 अपराह्न
Here's my solution:
using System;
class Bitwise
{
static void Main()
{
int number = int.Parse(Console.ReadLine());
int position = int.Parse(Console.ReadLine());
int numberRightposition = number >> position;
int bit = numberRightposition & 1;
Console.WriteLine(bit);
}
}
