eg0rmaffin

Сумма чисел последовательности

Jun 27th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     int sum = 0, x;
  5.     cin >> x;
  6.     while (x != 0) {
  7.         sum = sum + x;
  8.         cin >> x;
  9.     } cout << sum;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment