Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to find out number of on bits in a number?

Answer Posted / vaishu and hema

main()
{
int n,count=0,rem;
scanf("%d",&n);
while(n>0)
{
rem=n%2;
if(rem==1)
count++;
n=n/2;
}
printf("The number of on bits in the number is %d",count);
}

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is wrong in this statement?

1141


What is the purpose of 'register' keyword in c language?

1020


Is register a keyword in c?

1035


Is fortran still used in 2018?

1038


What is time null in c?

1069


What is difference between && and & in c?

1102


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2241


Are local variables initialized to zero by default in c?

1045


Write a program to generate the Fibinocci Series

1231


What is the purpose of void in c?

1066


What will be your course of action for a push operation?

1108


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

1275


Where are local variables stored in c?

1035


What is an example of structure?

1039


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

1120