Solution for Exercise 11-24

ex1124

#include <stdio.h>

int main()
{
    int result;

    result=(12-5)*2;
    printf("(12-5)*2=%d\n",result);
    return(0);
}

Output

(12-5)*2=14

Notes

* By enclosing 12-5 in Line 7 in parentheses, this operation is performed first. The result is then multiplied by 2.

* The output if you don't use parentheses (to disturb the order of precedence) is 2.