You can change values in the boxes before starting animation
Output
Variable Name   Value in Memory
       n1
       n2
       n2
       gcd
1 import java.util.Scanner;
2
3 public class GreatestCommonDivisorMethod {
4
5 public static void main(String[] args) {
6
7 Scanner input = new Scanner(System.in);
8
9
10 System.out.print("Enter first integer: ");
11 int n1 = input.nextInt();
12 System.out.print("Enter second integer: ");
13 int n2 = input.nextInt();
14
15 System.out.println("The greatest common divisor for " + n1 +
16 " and " + n2 + " is " + gcd(n1, n2));
17 }
18
19
20 public static int gcd(int n1, int n2) {
21 int gcd = 1;
22 int k = 1;
23
24 while (k <= n1 && k <= n2) {
25 if (n1 % k == 0 && n2 % k == 0)
26 gcd = k;
27 k++;
28 }
29
30 return gcd;
31 }
32 }