Question: using c++ Bitwise operators and if else Problem 1: Divide a number by 2 using bitwise operation. Hint: Apply a right shift on a number
using c++
Bitwise operators and if else Problem 1: Divide a number by 2 using bitwise operation. Hint: Apply a right shift on a number to divide it by 2 and left shift to multiply the number with 2. Problem 2: Write a program to check an integer is a power of 2? Hint: If the AND operation between a number n and n-1 equals to zero, then the number is a power of 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
