Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _07.FirstBit
- {
- class FirstBit
- {
- static void Main()
- {
- Console.Write("Enter a number: ");
- int number = int.Parse(Console.ReadLine());
- Console.Write("Enter a position to check bit: ");
- int position = int.Parse(Console.ReadLine());
- int result = number >> position;
- Console.WriteLine(result & 1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement