#include <stdio.h>
int main()
{
printf("Enter an integer: ");
int integer;
scanf("%d", &integer);
unsigned count = 0;
do
{
if (integer % 2)
++count;
} while (integer /= 2);
printf("Total of 1 is %u. ", count);
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter an integer: ");
int integer;
scanf("%d", &integer);
unsigned count = 0;
do
{
if (integer % 2)
++count;
} while (integer /= 2);
printf("Total of 1 is %u. ", count);
return 0;
}