Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <vector>
  4. using namespace std;
  5. int n = 0;
  6. vector<int> liczby;
  7. float suma = 0;
  8.  
  9. int main()
  10. {
  11. cout << "Podaj wielkosc tablicy: ";
  12. cin >> n;
  13. liczby.resize(n);
  14. for (int i = 0; i < n - 1; i++)
  15. {
  16. cout << "Podaj " << i + 1 << " liczbe: ";
  17. cin >> liczby[i];
  18. suma = suma + liczby[i];
  19. }
  20. cout << suma;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement