write a program to find out number of on bits in a number?

Answer Posted / jaskarann

int i,a;
{
cout<<enter the no whose bits you want to find";
cin>>i;
a=i*8;
cout<<No. of bits in this number is<<a;
getch();

Is This Answer Correct ?    5 Yes 36 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to print "hello world" without using a semicolon?

600


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

664


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

663


2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier.  Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed.  When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed.  Sequence of take-off is the sequence of addition to the waitlist

2521


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

721






we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

639


Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.

687


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

1494


Is it cc or c in a letter?

570


I came across some code that puts a (void) cast before each call to printf. Why?

685


What is the condition that is applied with ?: Operator?

667


write an algorithm to display a square matrix.

2226


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

611


a c code by using memory allocation for add ,multiply of sprase matrixes

2306


If errno contains a nonzero number, is there an error?

809