Runs perfect but dont acomplish the verification
package com.codegym.task.task14.task1420;
/*
GCD
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
// 1. The program should read 2 lines from the keyboard.
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int num1 = Integer.parseInt(reader.readLine());
if (num1 < 0 ) throw new NumberFormatException("\nPor favor:\n Incluir numeros positivos");
int num2 = Integer.parseInt(reader.readLine());
if (num2 < 0 ) throw new NumberFormatException("\nPor favor:\n Incluir numeros positivos");
if (num1 > 0 && num2 > 0) {
System.out.println(greatestCommonDivisor(num1, num2));
}
}
public static int greatestCommonDivisor(int number1, int number2) {
int min = Math.min(number1, number2);
int max = Math.max(number1, number2);
int remainder = max % min;
if ( remainder == 0) {
return min;
} else {
return greatestCommonDivisor(min, remainder);
}
}
}