5 A
5 A
h>
#include<math.h>
#include<string.h>
void main() {
double s[20], res, op1, op2;
int top, i;
char postfix[20], symbol;
top = -1;
else if (symbol == '+' || symbol == '-' || symbol == '*' || symbol == '^' || symbol
== '$') {
if (top<1) {
printf("Error: Insufficient operands\n");
return 1;
}
op2 = s[top--];
opl = s[top--];
res = compute (symbol, opl, op2);
s[++ top] = res;
}
}
if (top == 0) {
res = s[top--];
printf("\n The result is: %f\n", res);
} else {
printf("Error: Too many operands\n");
return 1;
}
return 0;