// pass two value to this function public static int HCF(int a, int b) { while (b > 0) { int temp = b; b = a % b; // % is remainder a = temp; } return a; }