Please I need help with the following exercise:
1.Write a program that continually reads in numbers from the user and adds them together until the sum reaches 100. Write another program that reads 100 numbers from the user and prints out the sum
2. Write a function that implements Euclid's method for finding a common factor of two numbers. It works like this:
- You have two numbers, a and b, where a is larger than b
- You repeat the following until b become zero
- a is changed to the value of b
- b is changed to the remainder when a (before the change) is divided by b (before the change)
- you then return the last vaule of a
Hints:
- Use a and b as parameters to the function
- Simply assume that a is greater than b
- The remainder when x is divided by z is calculated by the expression x % z
- Two variables can be assigned to simultaneously like this: x, y = y, y+1. Here x is given the value of y (that is, the value y had before the assignment) and y is incremented by one.