/* Following program shows the order of evaluation
of the given logical expression. Use the precedence
table, shown in the cover of your text and observe
how the operations are paranthesized, following the
precedence of each operation. */


#include <stdio.h>

main()
{
   int n=10, m=7, a=-1, b=5;
   int ans1, ans2, ans3;

   /* Original Expression */
   ans1 = m % 3 + n + 5 - (a + b) * n /4; 
   printf("%d\n",ans1);

   /* % has highest precedence in the following */
   ans1 = (m % 3) + n + 5 - (a + b) * n /4; 
   printf("%d\n",ans1);

   /* * has the next precedence */
   ans1 = (m % 3) + n + 5 - ((a + b) * n) /4; 
   printf("%d\n",ans1);

   /* / has the next precedence */
   ans1 = (m % 3) + n + 5 - (((a + b) * n) /4); 
   printf("%d\n",ans1);

   /* + has the next precedence */
   ans1 = (((m % 3) + n) + 5) - (((a + b) * n) /4); 
   printf("%d\n",ans1);

   /* = has the last and final precedence */
   ans1 = ((((m % 3) + n) + 5) - (((a + b) * n) /4)); 
   printf("%d\n",ans1);
}
