diff --git a/cv3/program.c b/cv3/program.c index 2e129db..9cf2e87 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -39,13 +39,13 @@ float calculate(struct stack* stack, char operator) res = num1+num2; break; case '-': - res = num1-num2; + res = num2-num1; break; case '*': res = num1*num2; break; case '/': - res = num1/num2; + res = num2/num1; break; } add(stack, res); @@ -80,7 +80,7 @@ int main(int argc, char const *argv[]) } for (int i = 0; i < calc_stack.size; i++) { - printf("%0.f ", calc_stack.values[i]); + printf("%2.f ", calc_stack.values[i]); } printf("\n"); }