GCD Subtraction Method

Procedure

Real Lab Procedure 

  1. User input numbers are stored in "num1" and "num2". 
  2. If "num1" is smaller than "num2", then swap the values. 
  3. Otherwise subtract the smaller number from larger number until the difference between them becomes zero. 
  4. After the loop ends both "num1" and "num2" stores the GCD. 

Simulator Procedure

  • Enter the input values. 
  • Click on the Submit button. 
  • Select the variables from the dropdown list.
  • Click on the Finish button or Start button to view the state diagram.
  • If you have clicked on the Start button then use Next and Previous button to view the State diagram.
  • Click on the Reset button when the State diagram is completed.