write a program to find out number of on bits in a number?
Answer Posted / naveen
//plz let me know whether it is correct or not...bcoz am just beginner
#include<stdio.h>
void main()
{
int j=0,i=0xFFFFE,temp=1;
int count=0;
while(j<=(sizeof(int)*8-1))
{
if(i&temp)
count++;
temp=temp<<1;
j++;
}
printf("%d",count);
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What is s or c?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
I need testPalindrome and removeSpace
#include
differentiate built-in functions and user – defined functions.
Write a program for Overriding.
What is the basic structure of c?
Can you pass an entire structure to functions?
Explain the binary height balanced tree?
What are the uses of a pointer?
Why is c not oop?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
What is data types?
What is an auto variable in c?
What are the advantages of external class?