Hi Amit,

If you are answer this question orally then the format you have given is
just a hexadecimal number. Its value would be 0x00003f33. So the number of
1's would be simply 2+4+2+2 = 10.
Programatically whatever solution Sahin has given seems to be good enough.

2010/8/4 Seçkin Can Şahin <seckincansa...@gmail.com>

> either count it with a for loop or if you are using C, use
> __builtin_popcount(int x)
>
> or
>
> x is given
> int count = 0;
> for(int i=0; i<32;i++) count += (x & (1<<i)) != 0;
>
>
> On Tue, Aug 3, 2010 at 12:04 PM, amit <amitjaspal...@gmail.com> wrote:
>
>> (3*4096+15*256+3*16+3). How many 1's are there in the binary
>> representation of the result.
>>
>> Is there a quick way to count the number of set bits in this number
>> manually???
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Bhanu
Mobile   +91 9886738496

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to