Click to See Complete Forum and Search --> : Question


Guru_Kid
February 8th, 2009, 10:41 PM
I'm not sure if this is the right forum but here it goes xD

Could someone help solve these Arithmetic Operators? I'm not certain on the values I got.

Given: int x = 5; What is the value of x after the execution of this expression? x = x + 4

Given: int x = 5; What is the value of x after the execution of this expression? x -= 2;

Evaluate: 7 + 6 % 4

Evaluate: 7 + (6 % 34)

Peter_B
February 9th, 2009, 11:01 AM
The 'Graphics Programming' forum is obviously not the right place for this question - what does it have to do with graphics?

These are clearly homework questions. People only tend to help you with these if you have first made an attempt to answer them yourself, rather than just asking for the answers.

Have you actually attempted these questions? Just look up the section on arithmetic operators in your programming language reference and the answers will be obvious.

Lindley
February 10th, 2009, 06:11 PM
The only one of those which shouldn't be trivally obvious is the third, and that can be resolved just by checking operator precedence rules.