Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. double num;
  6. double sum=0;
  7. int br = 0;
  8. do
  9. {
  10.     cout << "Insert number or 0 for exit:\n";
  11.     cin >> num;
  12.     if (num<0)
  13.     {
  14.         sum = sum+num;
  15.         br++;
  16.     }
  17. }
  18.     while (num != 0);
  19.     cout << "The sum is = " << sum << endl;
  20.     cout << "The negative numbers are:"<< br;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement