Utopian Tree : HackerRank Problem Solution

Utopian Tree : HackerRank Problem Solution

C Implementation:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main()
{
 int test,cycles;
 int growth,i;
 scanf("%d",&test);
 while(test>0)
 {
  scanf("%d",&cycles);
  growth=0;
  for(i=0;i<=cycles;i++)
  {
   if(i%2==0)
    growth=growth+1;
   else
    growth=growth+growth;
  }
  test--;
  printf("%d\n",growth);
 }
 return 0;
}