top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Find if an Integer Is Even using Bitwise Operator in C# ?

0 votes
322 views
How to Find if an Integer Is Even using Bitwise Operator in C# ?
posted May 5, 2016 by Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
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();
        }


    }

}
answer May 5, 2016 by Shivaranjini
...