Today I will give you the code of a program, this program will take 10 whole numbers from user no matter postie or negative, then it will output the sum of all positive numbers, sum of all negative numbers and sum of all ten numbers.

Here is code:-

So, enjoy the program.Code:#include <iostream> using namespace std; int main() { int num, count = 1, sum_postive = 0, sum_negative = 0, sum_all; cout << "Please enter ten whole numbers.\n"; cout << "Press return key after writing a number.\n"; cout << " \n"; do { cout << "Type your number\n"; cin >> num; if (num > 0) { sum_postive = sum_postive + num; } else { sum_negative = sum_negative + num; } count++; } while (count <= 10 ); cout << " \n"; cout << "Sum of your postive numbers are " << sum_postive << endl; cout << "Sum of your negative numbers are " << sum_negative << endl; sum_all = sum_postive + sum_negative; cout << " \n"; cout << "Sum of your all whole numbers are " << sum_all; }

## Bookmarks