The code run successfully. i even got an output but at the time of verify it showing infinity loops.please help
package com.codegym.task.task14.task1420;
/*
GCD
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int large = Integer.parseInt(bf.readLine());
int small = Integer.parseInt(bf.readLine());
if(large < small){
int temp = large;
large = small;
small = temp;
}
while(large != small){
large = large-small;
if(large < small){
int temp = large;
large = small;
small = temp;
}
}
System.out.println(large);
}
}