[algogeeks] Re: bits groups

2010-12-21 Thread bittu
Convert the given number in to binary  and stored into every bit into
array
now compare the a[i]==0 if true then print that value that is nithing
but zero else number doesn't has zero in its binary form.

e.g code is given below

int binary_zero(int n)
{

for(int i=0;iarraylength;i++)
{
a[i]=n%2;
if(ai[i]==0)
true;//take action
count_zero++

else
false//take action..
count_one++;

n=n/2;
}


}


Regards
Shashank Mani
Birla Istitue of Technology,Mesra
Computer Science Engg.
Cell No.+91-9740852296

-- 
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.



[algogeeks] Re: bits groups

2010-12-21 Thread bittu
hey in last program i forget to take a variable that the position of
one  so that we can print zero groups


shashank

-- 
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.



Re: [algogeeks] Re: bits groups

2010-12-21 Thread shubham singh
u can see topcoder and codechef tutorials may help

-- 
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.



[algogeeks] Re: bits groups

2010-12-21 Thread rajessge...@yahoo.com
no need to store in array

the function can look like this

int fun(int n)
{
int i=0,count=0;
boolean set=false;
while(isizeof(n)*8)
{
if(n^1==1)
{
if(set==false)
{
count++;
set=true;
}
}
else
set=false;
n=n1;
}






On Dec 21, 6:07 pm, shubham singh shubhamsisodia0...@gmail.com
wrote:
 u can see topcoder and codechef tutorials may help

-- 
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.