Solution for Exercise 11-23

ex1123

#include <stdio.h>

int main()
{
    int result;

    result=12/3/2;
    printf("12/3/2=%d\n",result);
    return(0);
}

Notes

* Because division has the same order of precedence, the equation is evaluated left-to-right.

* If the equation also mixed in multiplication, as in 2 * 12 / 4 * 5, the result would still be calculated left-to-right as both division and multi placation carry the same rank in the order of precedence.

* Can you guess the result of 2 * 12 / 4 * 5? If not, modify the code to display the answer.