Which has higher precedence in C -multiplication or division?

c

Solution

They have the same precedence and are always executed left to right.

2*3/2 = (2*3)/2 => 3
            6/2 => 3 

and

5%2*3/2 = ((5%2)*3)/2 => 1
              (1*3)/2 => 1
                  3/2 => 1 (integer gets truncated)

Problem

``` #include <stdio.h> int main(void) { int w=2*3/2; //1 int x=5%2*3/2; //2 printf("%d %d",w,x); return 0; } ``` OUTPUT 3 1 In (1); it is giving higher precedence to multiplication than division while in (2) its vice versa. Why so?

Original source