4
22/10/2024 2:40 p.m.
Themenstarter
Write an expression that extracts from given integer n the value of given bit at index p.
Examples:

1 Antwort
3
22/10/2024 2:40 p.m.
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);
}
}
