a += b ; is the same as a = a+b;
a -= b ; is the same as a = a-b;
a *= b ; is the same as a = a*b;
a /= b ; is the same as a = a/b;
a %= b ; is the same as a = a%b;
Suggested exercises:
- Create a program that uses three variables x, y, z. Their initial values will be 15, -10, 214. It should increase the value of these variables in 12 units, using the abbreviated format. What values do you expect to obtain? Compare it with the results obtained by the program.
- What would be the result of the following operations? a=5; b=a+2; b-=3; c=-3; c*=2; ++c; a*=b;
No comments:
Post a Comment