write a program to find out number of on bits in a number?
Answer Posted / venkat reddy
main()
{
int n,counter;
printf("enter a number");
scanf("%d",&n);// let n=5
while(n>0)
{
counter++;
n=n&(n-1);
}
printf("%d",counter);
getch();
}
| Is This Answer Correct ? | 11 Yes | 2 No |
Post New Answer View All Answers
What is an arrays?
What is %d called in c?
What is typedef struct in c?
What are the ways to a null pointer can use in c programming language?
Can static variables be declared in a header file?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
i want to know the procedure of qualcomm for getting a job through offcampus
What is the meaning of c in c language?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
What are actual arguments?
find the sum of two matrices and WAP for it.
What do you know about the use of bit field?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
how to find binary of number?
What is the heap?