According to the revision, the code is not meeting the task requeriments. The result I get with the inputs 24 and 42 is correct (6) but somehow it does not pass the test. What is wrong? public class Solution { public static void main(String[] args) throws Exception { BufferedReader irak=new BufferedReader(new InputStreamReader(System.in)); int x=Integer.parseInt(irak.readLine()); int y=Integer.parseInt(irak.readLine()); handiena(x,y); } public static void handiena (int x, int y){ if (x<1 || y<1) throw new IllegalArgumentException(); int gcd=1; //x eta y zenbakien zatitzaileak aurkitu for(int i=2;i<=x/2;i++){ if(x%i==0){ if (y%i==0){ while ((x%i==0) && (y%i==0)) { gcd=i*gcd; x=x/i; y=y/i; } } } } System.out.println(gcd); } }