fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. double n,x ;
  7. cin >> n;
  8.  
  9. long long sum =0 ;
  10. for (int i=1 ; i<=n ; i++)
  11. {
  12. x = pow(2,i);
  13. sum+=x ;
  14. }
  15. cout << sum << endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 5320KB
stdin
2
stdout
6