Why does return statement is throwing error when used Math function in a method.
public class HCF_1 {
    
    static int hcf(int a, int b)
    {
        int res = Math.max(a,b);
        while(true)
        {
            if(res%a==0 && res%b==0)
                return res;
            else res++;
        }
        return res;
    }
    public static void main(String[] args) {
        
        System.out.println(hcf(5,25));
    }
}
 
     
     
     
     
    