I run the program in eclipse IDE and there's no problem, but here, I can not pass a single one. and show: check your code. it looks like you have an infinite loop
I really do not understand.
I need help. Many Thanks
package com.codegym.task.task14.task1420;
/*
GCD
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num1 = Integer.parseInt(br.readLine());
// System.out.println("the first number is "+num1);
int num2 = Integer.parseInt(br.readLine());
// System.out.println("the first number is "+num2);
if (num1 < 0 || num2 < 0)
throw new NumberFormatException("Nums must be positive");
while (num1 != num2) {
if(num1 > num2)
num1 = num1 - num2;
else
num2 = num2 - num1;
}
System.out.println("the GCD is "+num2);
}
}