Hi!
I don't understand what else codegym wants from me...
The problem is with condition 2.
I would appreciate your help!
package com.codegym.task.task14.task1420;
/*
GCD
*/
import org.w3c.dom.ls.LSOutput;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Integer one = Integer.parseInt(reader.readLine());
Integer two = Integer.parseInt(reader.readLine());
if (one == 0 || two == 0 ){
throw new Exception();
}
if(one < 0){
one = - one;
}
if(two < 0){
two = - two;
}
System.out.println(GCD(one, two)); //printing GCD of 2 numbers
}
public static int GCD ( int one, int two){ //method to find GCD
if (two == 0) {
return one;
}
return GCD(two, one % two);
}
}