Advertisement
MeehoweCK

Untitled

Apr 16th, 2021
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. /*Napisz program, który pobiera od użytkownika dziesięć liczb naturalnych, po czym wypisuje ich sumę na ekran.*/
  6.  
  7. int main()
  8. {
  9.     unsigned liczba, suma = 0, licznik = 0;
  10.  
  11.     do
  12.     {
  13.         cin >> liczba;
  14.         ++licznik;
  15.         suma += liczba;
  16.     } while (licznik < 10);
  17.  
  18.     cout << "Suma wszystkich podanych liczb wynosi " << suma << endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement