hey i m trying to do my assignment ... i am just a beginner to this course please help me ! *i have to write a programme that reads in ten numbers and the output is the sum of all the numbers greater than zero , the sum of all numbers less than zero and the sum of all numbers , the user enter the ten numbers once each and they can use any order ....... kindly help me how to start my programe i.e how to seprate the numbers :/
> how to start my programe i.e how to seprate the numbers
This will read in 10 numbers and print them out, one by one:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
int main()
{
int number ;
for( int i = 0 ; i < 10 ; ++i )
{
std::cout << "enter a number: " ;
std::cin >> number ;
std::cout << "you entered " << number << '\n' ;
}
}
Now, extend it:
if( number > 0 ) add this number to sum of all the numbers greater than zero