Re: Test 1 Form A # 22


[ Follow Ups ] [ Post Followup ] [ CS1044 Web Discussion Board ] [ FAQ ]

Posted by Basil on December 18, 2001 at 21:09:13:

In Reply to: Test 1 Form A # 22 posted by J on December 18, 2001 at 20:25:54:

: I guess I don't understand problem 22 but, why isthe answer for number 22 is "Delta = 7"
: if X = 3 in the problem and it is divided by 2, then x%2 would be 5, not one....therefore Delta would never change and should equal 0.....could someone please explain why the answer is Delta = 7!!!!!!
: Thanks

Delta is initialized to 0 and X to 3
The modulus of 3/2 is 1
Delta = Delta (0) + X (3) = 3
X++ (4)
The modulus of 4/2 is 0
Delta = Delta (3) + X (4) = 7
X++ (5)
The modulus of 5/2 is 1 and not 0, so the operations will not be performed.
Delta = 7




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS1044 Web Discussion Board ] [ FAQ ]