Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Testing bitwise stuff
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var res = 0; res = equalPairOfBits(0, 0); Console.WriteLine("Expected: {0} Result: {1}", 1, res); res = equalPairOfBits(28, 27); Console.WriteLine("Expected: {0} Result: {1}", 8, res); res = equalPairOfBits(895, 928); Console.WriteLine("Expected: {0} Result: {1}", 32, res); } public static int equalPairOfBits(int n, int m) { Console.WriteLine("Binary N: {0}", toBinary(n)); Console.WriteLine("Binary M: {0}", toBinary(m)); return ((n ^ m) & -(n^m)) ; } public static string toBinary(int x) { return Convert.ToString(x, 2); } } }
run
|
edit
|
history
|
help
0
Split IPs to 8 and 16
C# Abstract class and method
23
zero comp
hay
C# INDEXER and OVERRIDE INDEXER
Sealed
Expression Tree - Demo2
Found many section of times intersect.
vera