Advertisement
MeehoweCK

Untitled

Dec 10th, 2020
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. /*Napisz program, który pobiera od użytkownika kolejne liczby
  6. naturalne dotąd, aż użytkownik poda liczbę zero.
  7. Wówczas program ma wypisać sumę podanych liczb.*/
  8.  
  9. int main()
  10. {
  11.     int liczba = 1, suma;
  12.  
  13.     for(suma = 0; liczba != 0; suma += liczba)
  14.         cin >> liczba;
  15.  
  16.     cout << suma << endl;
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement