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
Who is the main contributor in designing the c language after dennis ritchie?
How can this be legal c?
Explain what is a 'locale'?
explain what are pointers?
Do pointers take up memory?
main() { printf("hello"); fork(); }
Is fortran still used in 2018?
Explain the advantages and disadvantages of macros.
What are the scope of static variables?
‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .
Differentiate between ordinary variable and pointer in c.
What are qualifiers and modifiers c?
Explain what are the different file extensions involved when programming in c?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
p*=(++q)++*--p when p=q=1 while(q<=6)