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
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
Explain how are portions of a program disabled in demo versions?
how logic is used
What is non linear data structure in c?
What is the difference between array and pointer in c?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
Explain what is the difference between a free-standing and a hosted environment?
Is main is user defined function?
Is c easy to learn?
What is difference between static and global variable in c?
What are nested functions in c?
Array is an lvalue or not?
What is header file definition?