Below is a sample code snippet that demonstrates how to find if an Integer is even using Bitwise Operator in C#.
How to Find if an Integer Is Even using Bitwise Operator in C# ?
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; namespace AbundantcodeConsoleApp { internal class Program { private static void Main(string[] args) { int num = 8; bool retVal = ((num & 1) == 0); Console.WriteLine(retVal); Console.ReadLine(); } } }
Leave a Reply