Question: Write a function called countBits that takes an int as a parameter and provides the number of bits of the integer that are 0 and

Write a function called countBits that takes an int as a parameter and provides the number of bits of the integer that are 0 and the number of bits that are 1.
The function should print the number of 0 bits and the number of 1 bits.
Output example:
Enter an integer: 5000
The number of 0 bits in 5000: 27
The number of 1 bits in 5000: 5
Write a function called countBits that takes an

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!