title: C program to display the number if it is a power of 2 in an array
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main(){
      int num,i;
      scanf("%d",&amp;num);
  
      int a[num];
      for (i=0; i&lt;num; i++){
         scanf("%d",&amp;a[i]);
      }
  
      for (i=0; i&lt;num+1; i++){
          if (pow(2,i) == a[i]){
              printf("%d\n",a[i]);
          }
      }
  }
  </code></pre>
  
  <p>I am trying to create a program that displays an integer in an array if it is a power of two. ex; an array contains the integer (1,2,4,9) it will print 1,2 and 4 only.</p>
  
  <p>What is wrong with this code? It works on some test cases, but on most it doesn't.</p>