Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*Napisz program, który pobiera od użytkownika kolejne liczby
- naturalne dotąd, aż użytkownik poda liczbę zero.
- Wówczas program ma wypisać sumę podanych liczb.*/
- int main()
- {
- int liczba;
- int suma = 0;
- do
- {
- cin >> liczba;
- suma += liczba;
- } while(liczba != 0);
- cout << suma << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement