I want to subrtract every element from each other, kind of like this:
List<int> list = [20, 4, 3, 7];
list = SubtractAll(list); // 20 - 4 - 3 - 7
And the desired output being:
6
How would this be done? Is there a simple way of doing this?
I want to subrtract every element from each other, kind of like this:
List<int> list = [20, 4, 3, 7];
list = SubtractAll(list); // 20 - 4 - 3 - 7
And the desired output being:
6
How would this be done? Is there a simple way of doing this?
Copyright © 2021 Jogjafile Inc.
You can use Linq: