Advertisement
MeehoweCK

Untitled

May 1st, 2021
938
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.     int licznik = 0;
  10.     int suma = 0;
  11.     int liczba;
  12.  
  13.     while(licznik < 10)
  14.     {
  15.         cin >> liczba;
  16.         suma += liczba;
  17.         ++licznik;
  18.     }
  19.  
  20.     cout << "Suma podanych liczb wynosi " << suma << endl;
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement