Advertisement
Zeshin

task5

Jul 5th, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n;
  6.     scanf("%d", &n);
  7.     int i = 1;
  8.     while (i<n)
  9.     {
  10.         i*=2;
  11.     }
  12.     if(i == n)
  13.     {
  14.         printf("%d is a power of 2", n);
  15.     }else
  16.     {
  17.         printf("%d is not a power of 2", n);
  18.     }
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement