#include <stdio.h>
int top=-1;
int stack[100000];
void push(int a)
{
stack[++top]=a;
}
int pop()
{
if(top!=-1) return stack[top--];
}
int main()
{
int topa,topb;
int i,j,sum, na, nb,c=0;
char a[109]={},b[109]={};
scanf("%s %s",a,b);
topa=strlen(a)-1;
topb=strlen(b)-1;
while(topa!=-1 || topb!=-1)
{
na=nb=0;
if(topa!=-1) na = a[topa--]-'0';
if(topb!=-1) nb = b[topb--]-'0';
sum = na+nb +c;
push(sum%10);
c=sum/10;
}
if(c!=0)
{
push(c);
}
while(top!=-1)
{
printf("%d",pop());
}
return 0;
}
---------------------------------------------------------
#include <stdio.h>
int top=-1;
int stack[100000];
void push(int a)
{
stack[++top]=a;
}
int pop()
{
if(top!=-1)
return stack[top--];
}
int main()
{
char str[201]= {};
int i,sum,num=0, a, b;
gets(str);
for(i=0; str[i]!=0; i++)
{
if('0'<=str[i] && str[i]<='9') //์ซ์์ด๋ฉด
{
num=num*10+str[i]-'0';
if(str[i+1]==' ')
{
push(num);
num=0;
}
}
else if(str[i]!=' ') //์ฐ์ฐ์์ด๋ฉด
{
a = pop();
b = pop();
if(str[i]=='+')
{
push(a+b);
}
else if(str[i]=='*')
{
push(a*b);
}
else if(str[i]=='-')
{
push(b-a);
}
}
}
printf("%d",pop());
}



