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;
- using System.Numerics;
- class InvertingBits
- {
- static void Main(string[] args)
- {
- int n = 10;
- int pow = (int)Math.Log(n, 2)+1;
- //Console.WriteLine(pow);
- int assist = (int)Math.Pow(2, pow) - 1;
- int result = n ^ assist;
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement