Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int suma=0;
  8. int x;
  9. cout<<"Podaj ile elementów ma mieć ciąg: "<<endl;
  10. cin >> x;
  11.  
  12. int tab[x];
  13.  
  14. for (int i=0;i<x;i++){
  15.  
  16. cin>> tab[i];
  17. }
  18.  
  19. for (int j=0;j<x;j++){
  20. suma=suma + tab[j];
  21. cout<<suma<<" ";
  22. }
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement