### Go Language - Program to Check Whether a Number is Odd or Even

Hello everyone, today we will learn how to check whether the entered number is even or odd. Even numbers are the numbers that are divisible by 2 and the numbers that are not divisible by 2 are called odd numbers. Here, in this program, we will check whether the number is divisible by 2 or not. If divisible, then it is an even number, and if not then it is an odd number.

## Example 1: Check Whether the Number is Even or Odd

`package mainimport (    "fmt")func main() {    var number int    fmt.Println("Enter an integer value : ")    _, err := fmt.Scanf("%d", &number)    if err != nil {        fmt.Println(err)    }    CheckOddOrEven(number)}func CheckOddOrEven(number int) {    //If number is divisible by 2 then it's an even number    //else odd number    if number%2 == 0 {        fmt.Println("The entered number ", number, " is Even")    } else {        fmt.Println("The entered number ", number, " is Odd")    }}`

## Example 2:  Check whether the number is even or odd by using the bitwise XOR

`package mainimport (    "fmt")func main() {    var number int    fmt.Println("Enter an integer value : ")    _, err := fmt.Scanf("%d", &number)    if err != nil {        fmt.Println(err)    }    CheckOddOrEven(number)}func CheckOddOrEven(number int) {     //Check Using Bitwise XOR    if (number ^ 1) == number+1 {        fmt.Println("The entered number ", number, " is Even")    } else {        fmt.Println("The entered number ", number, " is Odd")    }}`