I have a list of type decimal containing 5 numbers: {10, 9, 100,73,3457}
. I have another list of 4 operators of type string between these numbers: *
multiplication -
subtraction /
division +
adding.
How can I get the result of the string? I do not know how to impose operator precedence.
10 * 9 - 100 / 73 + 3457 = ???
Here is the code I have, I'm approaching the problem in entirely the wrong way, how should it be done?
static List<decimal> numbers = new List<decimal>();
static List<string> operators = new List<string>();
foreach (decimal number in numbers)
{
foreach (string operatorz in operators)
{
resultnumber =
}
}