Go program to find number divisible by 5 and 11

This Go program to find number divisible by 5 and 11 allows users to enter any numeric value. Next, we used the If else statement to check whether it is divisible by 5 and 11. If True, the first statement is printed; otherwise, the second one.

package main

import "fmt"

func main() {

    var num int

    fmt.Print("Enter the Number that may Divisible by 5 and 11 = ")
    fmt.Scanln(&num)

    if num%5 == 0 && num%11 == 0 {
        fmt.Println(num, " is Divisible by 5 and 11")
    } else {
        fmt.Println(num, " is Not Divisible by 5 and 11")
    }
}
SureshMac:GoExamples suresh$ go run 5and11.go
Enter the Number that may Divisible by 5 and 11 = 55
55  is Divisible by 5 and 11
SureshMac:GoExamples suresh$ go run 5and11.go
Enter the Number that may Divisible by 5 and 11 = 22
22  is Not Divisible by 5 and 11

Golang program to find number divisible by 5 and 11

This golang program allows entering the maximum value. Next, we used for loop to iterate numbers from 1 to dnum. Within the loop, we used the If statement to check the number divisible by 5 and 11. If True, print that number.

package main

import "fmt"

func main() {

    var dnum int

    fmt.Print("Enter the Max Number that may Divisible by 5 and 11 = ")
    fmt.Scanln(&dnum)

    fmt.Print("\nThe List of Numbers that are Divisible by 5 and 11 \n")
    for num := 1; num <= dnum; num++ {
        if num%5 == 0 && num%11 == 0 {
            fmt.Print(num, "\t")
        }
    }
}
Golang program to find number divisible by 5 and 11 2