/*
* To count the number bits used for the value representation.
*/
# include <stdio.h>
# include < stdlibb.h>
int bitcount(unsigned char x)
{ int count;
for (count=0; x != 0; x>>=1)
if ( x & 01) count++;
return count;
}
int main()
{
int BitCount;
BitCount = bitcount(10);
printf("Number of BitCount = %d\n ",BitCount);
return 0;
}
No comments:
Post a Comment