write a program to find out number of on bits in a number?
Answer Posted / anu
#include<stdio.h>
#include<conio.h>
void main()
{
int n,cnt,rem
scanf("%d",&n);
cnt=1;
while(n!=0)
{
rem=n%2;
n=n/2;
cnt++;
}
printf("number of bits of the number is = %d",cnt);
getch();
}
| Is This Answer Correct ? | 0 Yes | 3 No |
Post New Answer View All Answers
How can I write a function analogous to scanf?
What is the general form of function in c?
Explain 'far' and 'near' pointers in c.
What is volatile variable in c?
the question is that what you have been doing all these periods (one year gap)
List the different types of c tokens?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Why is c still so popular?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
Why is c called c not d or e?
Where is c used?
What is volatile c?
Which is better malloc or calloc?
Explain the properties of union. What is the size of a union variable
Can a variable be both const and volatile?