Advertisement
MargaritaOwl

Summ

May 14th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. setlocale(LC_ALL, "rus");
  8.  
  9. int n, s = 0,i=1;
  10.  
  11. do
  12. {
  13. cout<<"a["<<i<<"] -> ";
  14. cin>>n;
  15. if (n!=0)
  16. s += n;
  17. i++;
  18. } while (n!=0);
  19. cout<<"SUM : "<<s<<'\n';
  20. system("pause");
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement