Computer Science, asked by anshul1909, 1 month ago

Given an integer, say N. You need to write a program to find the following. 1. The number of set bits (bits that are 1 in the bitwise representation) in N 2. The position of the least significant set bit 3. The position of the most significant set bit The output should be a string of the form: a#b#c, where a, b, c are answers for the above three queries respectively

Answers

Answered by ranjeetcarpet
1

(n-1); count++; } cout Number of 1's in n is: "<<count; The complexity of the program would be: number of 1's in n (which is constantly < 32

Explanation:

Similar questions