write a program to find out number of on bits in a number?
Answer Posted / rajkumar
#include<stdio.h>
void main()
{
int a,count=0;
while(a>0)
{
if(a%2==1)
count++;
a=a>>1;
}
printf("no of on bits =%d ",count);
}
Is This Answer Correct ? | 15 Yes | 1 No |
Post New Answer View All Answers
Explain how does flowchart help in writing a program?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Write a program on swapping (100, 50)
how many errors in c explain deply
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
Explain what are reserved words?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
Is it possible to have a function as a parameter in another function?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What is difference between structure and union in c programming?
What are the types of i/o functions?
What is struct node in c?
What is the use of header?
What are the similarities between c and c++?
What are the complete rules for header file searching?