There
are 2
different priorities of arithmetic expression
High
Priority: * / %
Low
Priority: + -
The
equation is evaluated in two passes
First
pass: High priority operators
Second
pass: Low priority operators
Expression:
x=9-12/3+3*2-1
1st Pass
x=9-4+3*2-1
x=9-4+6-1
2nd Pass
x=5+6-1
x=11-1
x=10
No comments:
Post a Comment