Advertisement
Technoblade777

Iteration with powers

Sep 15th, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace::std;
  4.  
  5. int main(){
  6.     long int nt, k, n = 1;
  7.     cin >> "Enter:" >> n;
  8.    
  9.     while(k < n){
  10.         k++;
  11.         nt += pow(2, k-1); //Почему вывод с единицы а не с 3?
  12.         cout << nt << endl;
  13.     }
  14.    
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement