Step 4 – printing the answer
The last part of the program simply prints out the Highest Common Factor.
This is just one line of Python code. It shouldn't be indented at all.
THEORY: We're printing the value of a variable here.
Once this is programmed you need to:
- Save your program
- Run your program several times
- Try simple numbers and bigger ones.
- Try a prime number. The HCF should always be 1 if either of the numbers you enter are prime numbers
That's the basic program done. Click here to extend it to three numbers