fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int main(void) {
  7. long n,i,pow2=1;
  8. cout<<"n=?"<<endl;
  9. cin>>n;
  10.  
  11. if (n<128) {
  12. for (i=0;i<n;i++)
  13. {cout<<"2pow"<<i<<"="<<pow2<<oct<<"="<<pow2<<endl;
  14. pow2=2*pow2;
  15. }
  16. }
  17. else cout<<"n prea mare";
  18. // your code goes here
  19. return 0;
  20. }
Success #stdin #stdout 0s 16064KB
stdin
20
stdout
n=?
2pow0=1=1
2pow1=2=2
2pow2=4=4
2pow3=10=10
2pow4=20=20
2pow5=40=40
2pow6=100=100
2pow7=200=200
2pow10=400=400
2pow11=1000=1000
2pow12=2000=2000
2pow13=4000=4000
2pow14=10000=10000
2pow15=20000=20000
2pow16=40000=40000
2pow17=100000=100000
2pow20=200000=200000
2pow21=400000=400000
2pow22=1000000=1000000
2pow23=2000000=2000000