/****************** EVALLUATION OF POSTFIX EXPRESSION *****************/ # include # include # include # include void main() { char ch,* post; int v1,v2,v,stk[20],top=0,max,i; clrscr(); printf("\n\n\t\t**** INPUT ****\n\n"); puts("Enter the postfix expression : "); gets(post); max=strlen(post); for(i=0;i= 'a' && tolower(ch)<='z') { v=value(ch); stk[top++]=v; } else { v2=stk[--top]; v1=stk[--top]; v=eval(v1,v2,ch); stk[top++]=v; } } printf("\n\n\t\t**** OUTPUT ****\n\n"); printf("\n----------------------------------------------------"); printf("\n THE RESULTANT VALUE IS : %d",stk[--top]); printf("\n----------------------------------------------------"); getch(); } value(char ch) { int val; printf(" ENTER THE VALUE FOR %c : ",ch); scanf("%d",&val); return(val); } eval(int a,int b,char ch) { int c; if(ch=='*') c=a*b; else if(ch=='/') c=a/b; else if(ch=='+') c=a+b; else if(ch=='-') c=a-b; return(c); }