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 ex2
- {
- class Program
- {
- static void Main(string[] args)
- {
- // set the bit at postion p to 0 ( clear the bit at position p )
- int p = 5;
- int n = 42; //00101010
- int mask = ~(1 << p); //00000101
- int result = n & mask; //00000001
- Console.WriteLine(result); //10
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment