при компиляции все работает, все считает и все печатает, но валидатор валит по последнему пункту, почему?
package com.javarush.task.task14.task1420;
/*
НОД
*/
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
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));
int[] mas = new int[2];
String str;
for (int i = 0; i < 2; i++) {
str = reader.readLine();
mas[i] = Integer.parseInt(str);
if (mas[i] <= 0) {
throw new Exception();
}
System.out.println(mas[i]);
}
reader.close();
while (mas[0] != mas[1]) {
if (mas[0] > mas[1]) {
mas[0] = mas[0] - mas[1];
} else {
mas[1] = mas[1] - mas[0];
}
}
System.out.println(mas[0]);
}
}