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
Which node is more powerful and can handle local information processing or graphics processing?
What is the condition that is applied with ?: Operator?
What is the meaning of ?
What does return 1 means in c?
Is a pointer a kind of array?
What is an expression?
What is scanf () in c?
what are the facialities provided by you after the selection of the student.
Write a program to print numbers from 1 to 100 without using loop in c?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
What is the right type to use for boolean values in c?
What do you know about the use of bit field?
What is fflush() function?
What are the differences between new and malloc in C?
In a byte, what is the maximum decimal number that you can accommodate?