/home/caleb/ASDV-Java/Assignments/MP3_CalebFontenot/src/mp3_calebfontenot/GCDWhile.java

    /*
     * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
     * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
     */
    package mp3_calebfontenot;

    /**
     *
     * @author caleb
     */
    public class GCDWhile {

        public static void main(String[] args) {
            java.util.Scanner input = new java.util.Scanner(System.in);
            System.out.print("Enter the first number: ");
            int n1 = input.nextInt();
            System.out.print("Enter the second number: ");
            int n2 = input.nextInt();

            int d = (n1 < n2) ? n1 : n2;
            while (d >= 1) {
                if ((n1 % d == 0) && (n2 % d == 0)) {
                    break;
                }
                d--;
            }
            System.out.println("GCD of " + n1 + " and " + n2 + " is " + d);
        }
    }