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 = 1, suma;
- for(suma = 0; liczba != 0; suma += liczba)
- cin >> liczba;
- cout << suma << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement