### Find the HCF of 2 numbers using Java code

Today we'll try to solve a common mathematical question using Java code. We will find the HCF of two numbers. What is HCF - its the Highest Common Factor of two numbers. Which means it is the biggest number which divides two numbers such that the remainder is 0. What will be utilized in this logic: 1. While loop to iterate till we arrive at the solution 2. % Operator to find the remainder Let's check the code! /** * Find the HCF of two numbers * @author computengine.com * @param num1 * @param num2 * @return */ public static void findHCF ( int num1 , int num2 ) { int remainder = 0 ; System . out . println ( " Input Num1: " + num1 ) ; System . out . println ( " Input Num2: " + num2 ) ; //loop till we find a number which divides exactly while ( num1 % num2 > 0 ) { //find the remainder of the division remainder = num1 % num2 ; System . out . println ( " Remainder: " + remainder ) ; //put