write a program to find out number of on bits in a number?
Answer Posted / arijit
#include<stdio.h>
#include<conio.h>
void main()
{
int n,cnt,rem
scanf("%d",&n);
cnt=0;
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 | 0 No |
Post New Answer View All Answers
Why main is not a keyword in c?
Where register variables are stored in c?
What is scanf_s in c?
Which node is more powerful and can handle local information processing or graphics processing?
What is selection sort in c?
What does c mean?
What is a pointer and how it is initialized?
How can you avoid including a header more than once?
What is meant by realloc()?
Explain function?
What are the 5 types of organizational structures?
write a program to print largest number of each row of a 2D array
please explain every phase in the "SDLC" in the dotnet.
What do you mean by recursion in c?
What do mean by network ?