Advertisement
Spocoman

03. Sum Numbers

Sep 10th, 2023
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int num, sum = 0, number;
  7.     cin >> num;
  8.  
  9.     while (sum < num) {
  10.         cin >> number;
  11.         sum += number;
  12.     }
  13.  
  14.     cout << sum << endl;  
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement