Im making a method that is passed an array of positive and negative numbers. Im trying to return an array of the count of positive integers, aswell as the sum of the negative ones. Im fairly new to the ternary but im trying to implement one into this for practice. Getting an unexpected type error in my ternary. Was wondering if anyone could give some pointers
public static int[] countPositivesSumNegatives(int[] input)
{
int[] answer = new int[2];
for(int i=0; i<=input.length; i++){
input[i] > 0 ? answer[0] += 1 : answer[1] += input[i];
}
return answer;
}