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
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
difference between native and cross compilers
Explain how can you check to see whether a symbol is defined?
What is the basic structure of c?
The __________ attribute is used to announce variables based on definitions of columns in a table?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
Difference between exit() and _exit() function?
What is difference between scanf and gets?
Can we change the value of constant variable in c?
Explain how can I prevent another program from modifying part of a file that I am modifying?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
If the size of int data type is two bytes, what is the range of signed int data type?
Why doesnt that code work?
What is a list in c?
When should a type cast be used?