Golang to Find the GCD and LCM of Two Integers

Today, We want to share with you Golang to Find the GCD and LCM of Two Integers.In this post we will show you GO Program to Find the GCD and LCM of Two Integers, hear for Find GCD of Two Numbers Using Golang Recursion we will give you demo and example for implement.In this post, we will learn about GO program to find gcd of two numbers using recursion with an example.

Golang to Find the GCD and LCM of Two Integers

There are the Following The simple About Golang to Find the GCD and LCM of Two Integers Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to find gcd of two numbers using GO Program, so the Program To Find HCF In GO for this example is following below.

Example of Switch in ….. Case GO Program to calculate the maths formula LCM and GCD of two any integers. The simple as well as used to For…Loop used as a While Loop in this Golang example below.

Another must read:  Check Armstrong Number in GO Program

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Golang Program to find LCM and GCD of two numbers

package main
import "fmt"
func lcm(first_tmp int,second_tmp int) { 
    var lcmnum int =1
    if(first_tmp>second_tmp)    {
    for {        
        if(lcmnum%first_tmp==0 && lcmnum%second_tmp==0) { 
            fmt.Printf("LCM of %d and %d is %d",first_tmp,second_tmp,lcmnum)            
func gcd(first_tmp int,second_tmp int){
       var gcdnum int 
    for i := 1; i <=first_tmp && i <=second_tmp ; i++ {
            if(first_tmp%i==0 && second_tmp%i==0) {
        fmt.Printf("GCD of %d and %d is %d",first_tmp,second_tmp,gcdnum)
func main() {
    var first_no,second_no,action int
    fmt.Println("Please Enter Your Any two positive integers : ")
    fmt.Println("Enter 1 for LCM and 2 for GCD")
    switch action {
        case 1:
        case 2:

here above Go Program Example To Use of Switch Case.

Pattern programs in GO Example
Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Golang to Find the GCD and LCM of Two Integers.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Another must read:  Go Program to Print Pyramid Pattern using numbers

Leave a Reply

Your email address will not be published. Required fields are marked *