#include <stdio.h>
int isAllBitsUnset(unsigned int num)
{
int loop, cnt=0;
for(loop=7; loop>=0; loop--)
{
if( num & (1<<loop))
{
cnt =1;
break;
}
}
if(cnt==0)
return 1; //true
else
return 0; //false
}
int main()
{
unsigned int number;
printf("Enter an integer number (between 0-255): ");
scanf("%d",&number);
if(isAllBitsUnset(number))
printf("All bits are UNSET/LOW.\n");
else
printf("All bits are not UNSET/LOW.\n");
return 0;
}
C Programming
Program to check whether all bits of a number are UNSET/LOW?

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
