Advertisement
MeehoweCK

Untitled

Apr 19th, 2021
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int wynik = 0;
  8.     int potega = 1;
  9.     int licznik = 0;
  10.    
  11.     /*do
  12.     {
  13.         wynik += potega;
  14.         ++licznik;
  15.         potega *= 2;
  16.     } while(licznik < 10);*/
  17.    
  18.     /*for(licznik = 0; licznik < 10; ++licznik)
  19.     {
  20.         wynik += potega;
  21.         potega *= 2;
  22.     }*/
  23.    
  24.     while(licznik < 10)
  25.     {
  26.         wynik += potega;        // wynik = wynik + potega;
  27.         ++licznik;
  28.         potega *= 2;            // potega = potega * 2;
  29.     }
  30.    
  31.     cout << wynik << endl;
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement