I now that this question it has been mada many times but,
I need a function to calculate the sum of odd numbers in a given stack S
I have try something like this, but i now that it is not correct.
private static int Sum(int n, x)
{
if (n % 2 == 0) && (x % 2 == 0)
return n + x;
}
just an example, you could pass your stack variable as an argument to the
GetSum()function.