Habsburg

trece

Apr 7th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N = 0;
  6. do {
  7. cout << "Upisite N :D \n";
  8. cin >> N;
  9. }while( N < 0 || N > 31);
  10.  
  11. if(N == 0) {
  12. cout << 1;
  13. return 0;
  14. }
  15.  
  16. int multi = 2;
  17. int suma = 1;
  18. for(int i = 0; i < N; ++i) {
  19. suma *= multi;
  20. }
  21. suma -= 1;
  22. cout << suma;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment