Hi,
To get all negative integers from the array, try this:
int[] neg = num.Where(x => x < 0).ToArray();
To change the negative numbers in
neg
into positive numbers, try this:
int[] negToPos = neg.Select(x => Math.Abs(x)).ToArray();
And if you just want to change all negative numbers in
num
into positive numbers, try this:
int[] pos = num.Select(x => Math.Abs(x)).ToArray();
Hope this helps.