programming-examples/c/Bitwise/C Program to Count the Number of Trailing Zeroes in Integer.c
2019-11-15 12:59:38 +01:00

26 lines
538 B
C

/*
* C Program to Count the Number of Trailing Zeroes in Integer
*/
#include <stdio.h>
void main()
{
int j = 31, i, count = 0;
unsigned int num;
int b[32] = {0};
printf("enter the number:");
scanf("%d", &num);
while (num != 0)
{
if (num & 1 == 1)
{
break;
}
else
{
count++;
num = num >> 1;
}
}
printf("\n%d", count);
}