Module Module1 Sub Main() 'in any program we must declare variables Dim firstNum, secondNum, TEMP, HCF As Integer ' "As Integer" symbolizes that the nature of data for these variables are integers 'first we inform the user about the instructions Console.WriteLine("enter two numbers for highest common factor") 'then we prompt the user to enter a number Console.WriteLine("enter first number") 'we store the digit in to a variable firstNum firstNum = Console.ReadLine 'then we prompt the user to enter a second number Console.WriteLine("enter second number") 'similarly we store that too, but in a different variable ' we dont want the first one to be overwritten secondNum = Console.ReadLine 'we compare which one is larger and store it into a Temporary storage "TEMP" If firstNum < secondNum Then TEMP = firstNum ElseIf firstNum > secondNum Then TEMP = secondNum 'in the clause underneath we stored a value into the TEMP even though the first and second numbers were equal 'this is because we needed the "highest" number of the either whatever it may be. ElseIf firstNum = secondNum Then TEMP = secondNum End If 'here is where the programming really begins 'the mod function divides the integer by a number and returns the remainder 'this is useful, in this way we can check by which numbers are the remainders zero 'here we use a "FOR ITERATION LOOP" to do the job 'we create a variable 'i' and increase it by 1 after every loop For i = 1 To TEMP Step 1 '"Step 1" shows that there is an increment of 1 after every loop 'as you can see we also used an AND function 'this is because we only needed numbers which divides both variables giving remainder zero 'another important note is that we cannot begin i at 0 'this is because anything divided by 0 may lead to infinity If ((firstNum Mod i = 0) And (secondNum Mod i = 0)) Then 'we store the numbers into variable "HCF" ' every time a greater variable is found HCF is overwritten HCF = i End If Next Console.Clear() ' this command clears anything written on the console screen Console.WriteLine("highest common factor = " & HCF) 'this command displays message on console screen 'the commands underneath allows for exiting the console screen Console.WriteLine() Console.WriteLine("PRESS ANY BUTTON TO EXIT") Console.ReadKey() 'P.S 'while programming, as long as you do not ruin the syntaxes ' you are free to put spaces, tabs or empty lines to make the program look less messy End Sub End Module