sorting arrays and passing values from one array to another

Hello. I have a homework problem that asks me to write a program that takes in ten integers into an array. Then I need to call a function that outputs the sum of all the negative integers, positive integers and all the integers. I'm lost. How do I compare the values in the array and then sort them into positive and negative.

take ten integers into an array. Then call a function that outputs the sum of all the negative integers, positive integers and all the integers.

There is no word "sort" in that. All you need to do is to sum up numbers from array, if they meet the criteria. Surely you know when a number is negative and when it is positive? The third sum should be trivial, once you know the other two.

You need to know
- input
- loops
- function call, with pass an array as argument
- conditional
- output
Topic archived. No new replies allowed.