Не могу понять в чем ошибка, и если ли она в принципе?
package com.javarush.task.task14.task1420;
/*
НОД
*/
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));
System.out.println("Введите число а: ");
int a = Integer.parseInt(reader.readLine());
System.out.println("Введите число b: ");
int b = Integer.parseInt(reader.readLine());
try {
while (a != 0 && b != 0) {
if (a <= 0 || b <= 0)
throw new Exception();
if (a > b)
a = a % b;
else
b = b % a;
}
}catch (Exception e){
throw e;
}
System.out.println(a + b);
}
}