Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sol(int n);
- int sol(int n)
- {
- return !(n & (n - 1)) && (n % 3 == 1);
- }
- int main(void)
- {
- int n;
- if (scanf("%d", &n) != 1)
- {
- printf("cannot read n!\n");
- }
- if (sol(n)) {
- printf("is a power of 4\n", &n);
- }
- else {
- printf("is not a power of 4\n", &n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement