Java Soln without recursion


#1

Comment body goes here.`if(A == 0) return B;
if(B == 0) return A;
int C = A;
int D = B;

    if(A >=B){
        while(A%B!=0){
       int m = A%B;
       A = B;
       B = m;
        }
    }else{
        while(B%A!=0){
       int m = B%A;
       B = A;
       A = m;
        }
    }
    
    return C >= D ? B :A;`