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 / arijit

#include<stdio.h>
#include<conio.h>
void main()
{
int n,cnt,rem
scanf("%d",&n);
cnt=0;
while(n!=0)
{
rem=n%2;
n=n/2;
cnt++;
}
printf("number of bits of the number is = %d",cnt);
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is main function in c?

1021


What is the difference between printf and scanf )?

1026


How can I direct output to the printer?

1277


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2064


Do array subscripts always start with zero?

1240


What is the difference between fread and fwrite function?

1035


How do we print only part of a string in c?

976


Why #include is used in c language?

997


How will you delete a node in DLL?

1223


i got 75% in all semester am i eligible for your company

2173


how to capitalise first letter of each word in a given string?

1875


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

2392


Tell us two differences between new () and malloc ()?

1119


Explain how to reverse singly link list.

1075


If errno contains a nonzero number, is there an error?

1296