fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int val = 0;
  6. const int Iterations = 10;
  7. for( int i = 0; i < Iterations; ++i )
  8. {
  9. val += val + 1;
  10. std::cout << "Val = " << val << std::endl;
  11. }
  12. return 0;
  13. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Val = 1
Val = 3
Val = 7
Val = 15
Val = 31
Val = 63
Val = 127
Val = 255
Val = 511
Val = 1023