Saturday, April 12, 2014

Gcd program in java


public class gcd1
{
public static int gcd(int x,int y)
{
if(y==0)
{
return x;
}
else
{
return gcd(y,x%y);
}
}
public static void main (String args [])
{
System.out.println(gcd(10,5));
}
}