Created
August 23, 2022 06:29
-
-
Save faisal95bd/45e1c82c0e747f2538861f9e6d91b83f to your computer and use it in GitHub Desktop.
Detect Power of Two
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() { | |
int num; | |
printf("Enter a positive nonzero integer\n"); | |
scanf("%d", &num); | |
if(num && ((num & (num-1)) == 0)){ | |
printf("Yes", num); | |
} else { | |
printf("No", num); | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment