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
What is wrong in this statement?
What is the purpose of 'register' keyword in c language?
Is register a keyword in c?
Is fortran still used in 2018?
What is time null in c?
What is difference between && and & in c?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
Are local variables initialized to zero by default in c?
Write a program to generate the Fibinocci Series
What is the purpose of void in c?
What will be your course of action for a push operation?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
Where are local variables stored in c?
What is an example of structure?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above