/* * Chapter9 * SelfTest1.question3.c * By John Stile * Purpose: If the variable aa is equal to 5, * what is the value of each of the following? */ #include int main(void) { int aa=5; printf("Value of aa in the beginning is:\t%d\n",aa); aa=5; aa*=7 ; printf("Value of aa after (aa*=7) is:\t%d\n", aa); aa=5; aa/=2; printf("Value of aa after (aa/=2) is:\t%d\n", aa); aa=5; aa+=4; printf("Value of aa after (aa+=4) is:\t%d\n", aa); aa=5; // ERROR(aa*=5)%=3; // error: invalid lvalue in assignment // // However, this does work // aa*=5; // aa%=3; // // Analysis of operators // () has prcidence,so // aa*=5 results in aa, with value of 25 // Next %= has precidence, so // aa%=3 resutls in aa, with value of 1 // //printf("Value of aa after ((aa*=5)%=3) is:\t%d\n", aa); return 0; }