Fortinet Interview Question

How would you write a program to find out how many set bits are in a number?