Read Chapter 1 of the course text.
Do the following problems from Chapter 1 (page 34): exercises 1, 6, 7a, 8, and 9.
Consider the following algorithm:
1. Get two positive integers as input. Call them R and D, respectively. 2. Let Q be 0. 3. If R is less than D, go to step 7. 4. Increase Q's value by 1. 5. Subtract D from R. 6. Go back to step 3. 7. Print out Q and R.
Go through the algorithm, step-by-step, to show the output produced when the inputs are as follows:
i) R is 4 and D is 2. ii) R is 15 and D is 5. iii) R is 29 and D is 7.
In a clear and concise sentence explain what this algorithm can be used to compute.
If we remove the restriction that D must be a positive integer, is this still an algorithm? Explain.