public static int ebob; static int tutucua; static int tutucub; public static int ebobbul(int a,int b) { tutucua = a; tutucub = b; if(tutucua%tutucub == 0 || tutucub%tutucua == 0) { if(tutucua>=tutucub) return ebob = tutucub; if(tutucub>=tutucua) return ebob = tutucua; } else { if(tutucua>tutucub) // a 24 , b ise 30 { if(tutucua%b == 0 && tutucub%a == 0) { ebob = b; } ebobbul(--a,--b); } else { if(tutucub%a == 0 && tutucua%b == 0) { ebob = a; } ebobbul(--a,--b); } } return ebob; } public static void main(String[] args) { System.out.println(ebobbul(5,15)); }