Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int num;
- printf("Enter number: ");
- scanf("%d", &num);
- int flag = 0;
- int i = 1;
- while(i <= num)
- {
- if(i == num)
- {
- flag = 1;
- break;
- }
- i *= 2;
- }
- if(flag)
- {
- printf("%d is by the power of 2!", num);
- }
- else
- {
- printf("%d is not by the power of 2!", num);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement