Programming Code Center(PCC)
[JAVA]

(PCC)::[How-to-write-Java-Program-to-Find-GCD-Using-Recursion]::[java]

File Name : GCDNew.java

//Example: GCD of Two Numbers using Recursion
public class GCDNew {

    public static void main(String[] args) {
        int n1 = 366, n2 = 60;
        int hcf = hcf(n1, n2);

        System.out.printf("G.C.D of %d and %d is %d.", n1, n2, hcf);
    }

    public static int hcf(int n1, int n2)
    {
        if (n2 != 0)
            return hcf(n2, n1 % n2);
        else
            return n1;
    }
}

Output :

GCDNew.jpg