UNIT 5 notes click below link
https://sites.google.com/site/cs6202pds1/home
Save water:
Espure water solutions Pvt Ltd
http://enpure.in/sewage-treatment-plant/
#include<stdio.h>#include<conio.h>#include <ctype.h>int s[20];int top=-1; push(int elem){ top++;
s[top]=elem;}int pop(){ return(s[top--]);}void main(){ char pofx[50],ch; int i=0,op1,op2; printf("\n\nRead the Postfix Expression ? "); scanf("%s",pofx); while( (ch=pofx[i++]) != '\0') { if(isdigit(ch)) push(ch-'0'); else { op2=pop(); op1=pop(); switch(ch) { case '+': push(op1+op2); break; case '-': push(op1-op2); break; case '*': push(op1*op2); break; case '/': push(op1/op2); break; } } } printf("\n Given Postfix Expn: %s\n",pofx); printf("\n Result after Evaluation: %d\n",s[top]);getch(); }
void fun2(struct node* head)
{
if(head== NULL)
return;
printf("%d
", head->data);
if(head->next !=
NULL )
fun2(head->next->next);
printf("%d ",
head->data);
} |
|
|