Displaying Source Code(s)
|
|
Program for counting number of Parity Bits in an integer.
--------------------------------------------------------------------------------
Description : Program for counting number of Parity Bits in an
integer.
main()
{
int num, cnt = 0;
printf("enter the no :");
scanf("%d",&num);
while (num != 0)
{
num = num & (num - 1);
cnt++;
}
printf("
number of parity bits = %d ",cnt);
}
|
|
|