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

Why main is not a keyword in c?

1260


Where register variables are stored in c?

971


What is scanf_s in c?

1127


Which node is more powerful and can handle local information processing or graphics processing?

1328


What is selection sort in c?

1109


What does c mean?

1059


What is a pointer and how it is initialized?

1166


How can you avoid including a header more than once?

988


What is meant by realloc()?

1164


Explain function?

1098


What are the 5 types of organizational structures?

1085


write a program to print largest number of each row of a 2D array

2328


please explain every phase in the "SDLC" in the dotnet.

2625


What do you mean by recursion in c?

1118


What do mean by network ?

1173