One student will explain how to draw an image under the following restrictions.
The rest of the students should try to draw the figure according to the instructions.
Explain what the following algorithm does.
- Given: two positive natural numbers a & b
- Set remainder = some non-zero value
- Repeat these steps until remainder = 0
- Set remainder = the remainder of a divided by b
- If remainder = 0 Then
- Print GCD is b
- Set a = b and b = remainder
- Go on to the next repetition
- Test Cases: GCD(36,16)→4; GCD(1,1)→1; GCD(1260,198)→18
Write an algorithm for sorting cards under the following restrictions.
Write algorithms that implement solutions to the following problems.
We’d like to print the following famous phrase “My name is Bond, James Bond.” using whatever first and last names the user enters.
We’d like to print the sum of any two numbers the user enters.