You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
558 B
C#

/*
* C# Program to Find Power of 2 using Bitwise Operator
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace example
{
internal class Program
{
private static void Main(string[] args)
{
int num;
Console.Write("Enter a number:");
num = Convert.ToInt32(Console.ReadLine());
bool result = ((num & -num) == num);
Console.WriteLine(result);
Console.ReadLine();
}
}
}
/*
Enter a number:16
True