Check Power of Two
/*
filename:Power Of Two Using Bit Manipulation
how to check given number is power of two
Using bit Manipulation
*/
#include<stdio.h>
int main(){
int a=128;
printf( ( a && !(a & (a-1) )) ? "true" : "false" );
return 0;
}
filename:Power Of Two Using Bit Manipulation
how to check given number is power of two
Using bit Manipulation
*/
#include<stdio.h>
int main(){
int a=128;
printf( ( a && !(a & (a-1) )) ? "true" : "false" );
return 0;
}
Comments
Post a Comment