Download MetaTrader 5

How to do summation on MT5? 1+2+4+8

To add comments, please log in or register
jon
465
jon  

How to do summation on MT5? 

1+2+4+8+16+....n

Biantoro Kunarto
15343
Biantoro Kunarto  

Try this :

   int n = 10;
   int Sum = 0;
   for (int i = 0; i < 5; i++)
      {
         Sum += MathPow(2,i);
      }
   Print(Sum);
Ernst Van Der Merwe
4803
Ernst Van Der Merwe  
      int sum=0;
      for(int i=1,n=0;n<20;i*=2,n++)
         sum+=i;
      Print(sum);
To add comments, please log in or register