write a program to find out number of on bits in a number?
Answer Posted / ram
#include<stdio.h>
void main()
{
int a,count=0;
printf("enter a");
scanf("%d",&a);
while(a>0)
{
if(a%2==1)
count++;
a=a>>1;
}
printf("no of on bits =%d ",count);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Differentiate between the expression “++a” and “a++”?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
What is meant by high-order and low-order bytes?
What is unary operator?
Can we declare function inside main?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
How do you declare a variable that will hold string values?
Explain enumerated types in c language?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
What is the right type to use for boolean values in c?
write a program to find out prime number using sieve case?
What is meant by int main ()?
What are local variables c?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
Why calloc is better than malloc?