hello all!! I really need a little help! My problem is that I am writing a simple calculator which is actually my homework and it must do calculation like 2*4+5 is 13..that is there is no precedence..But I dont know how I can write +5 after first equ( 2*4)..My program just gives 8 as a result..Pls help me!! what ı wrote::
Code:
int main(){
int a,b,sum,c;
char ch;
printf("enter your application\n");
scanf("%d%c%d",&a,&ch,&b);
while(ch!='!' ){
if(ch=='+')
sum=a+b;
if(ch=='-')
sum=a-b;
if(ch=='/')
sum=a/b;
if(ch=='*')
sum=a*b;
scanf("%c%d",&ch,&c);
printf("%d",sum);
anykey();
return 0;
}