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
What are the types of data structures in c?
Why is sprintf unsafe?
Do you have any idea about the use of "auto" keyword?
Write a program to generate random numbers in c?
Tell us the use of fflush() function in c language?
How are strings stored in c?
Explain what is the difference between text files and binary files?
What does typedef struct mean?
By using C language input a date into it and if it is right?
write a program to copy the string using switch case?
Write a function that will take in a phone number and output all possible alphabetical combinations
Explain what are multidimensional arrays?
What is the use of #include in c?
How to find a missed value, if you want to store 100 values in a 99 sized array?
What is struct node in c?