var x=document.getElementById("x").value;
var y=document.getElementById("y").value;
var r;
    
if(x<y){
    z=x;
    x=y;
    y=z;
}
    
while((z=x%y)!=0){
    x=y;
    y=z;
}
    
document.write(y);

