0

I'm working towards a game development degree and I'm not off to a good start. I'm having trouble understanding algorithms. I posted part of an assignment to give an example of what im having trouble with. I'm sure the assignment listed below is extremely elementary for most of you, but please keep in mind that the concepts are completely foreign to me. Any helpful comments or links regarding this material would be greatly appreciated!!
Thanks,
Emily

Part A). Input: two integers a and b

a = 108 b = 16

Step 1: Set q to the quotient of a divided by b: {q ßa/b}
Step 2: Set r to the remainder of a divided by b. {r ßa % b} {% is the remainder operator}
Step 3: If r is equal to 0 then go to step 7
Step 4: Set a to b. {a ßb}
Step 5: Set b to r. {b ß r}
Step 6: Go to step 1
Step 7: Print out b and quit


a b Q r
108 16

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Phaelax
0

So what trouble are you having? It's telling you exactly step by step what to do.

Step 1: q = a/b
q = 108/16
q = 6.75

Step 2: % is modulus or the remainder of a division. So 10/3 would 3 1/10, the remainder is 1.

The steps are pretty self explanatory. Set a to b, should be clear enough.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.