4
22/10/2024 2:40 pm
Topic starter
Write an expression that extracts from given integer n the value of given bit at index p.
Examples:
1 Answer
3
22/10/2024 2:40 pm
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); } }