Hi guys i need help on a program please.
I was asked to write a program for class where it ask the user to enter 10 numbers of any choice whether negative or positive. at the end it should display the sum of all negative numbers and the sum of all positive numbers. then also display the average of the negative numbers and average of positve numbers.
This was all i came up with, it worked but i cant find the average:
CODE
#include <iostream>
using namespace std;
int main()
{
int sum_greater_than_zero = 0, num_greater_than_zero= 0, num_less_than_zero= 0, sum_less_than_zero = 0;
int counter = 0;
int numbers;
int average;
while(counter < 10)
{
cout << "Please enter Number\n";
cin >> numbers;
counter++;
if (numbers <= 0 )
sum_less_than_zero += numbers;
else if ( numbers > 0 )
sum_greater_than_zero += numbers;
}
cout << "The Sum of all negative numbers are" << sum_less_than_zero<< "\n";
cout << "The Sum of all positive numbers are" << sum_greater_than_zero<< "\n";
cout << "The Average of Negative numbers are" << average<< "\n";
cin >> numbers;
return 0;
}