Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double num;
- double sum=0;
- int br = 0;
- do
- {
- cout << "Insert number or 0 for exit:\n";
- cin >> num;
- if (num<0)
- {
- sum = sum+num;
- br++;
- }
- }
- while (num != 0);
- cout << "The sum is = " << sum << endl;
- cout << "The negative numbers are:"<< br;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement