I have a question for an exam and by the way that it sounds, it could be a trap question:
How many assignments will there be executed in the following algorithm if
n
andp
are considered to be integers?
p=1;
n=279;
while (n>=100) {
p=p*10;
n=n-100;
}
I would say that there are 4 assignments in the while loop and two before the while ... so 6 ? I'm not sure why the question highlights the integer feature of the variables.