I want to create an array of 4 single digit numbers in the range [-9,9] without 0. Addition of these 4 numbers should result in a positive number within 0-9 range. for ex. a= [4,-2,3,-1] =4. However 1st number should be compulsorily positive. And subsequent addition/subtraction should be valid.(i.e. negative number should be subtracted from a positive number). Any help would be greatly appreciated.
So far I have tried this:
if sum(a)>=0 && sum(a)<9