//this file contains several examples by Golang
package main

import (
	"fmt"
)

func main() {

	//Check if number is odd or even
	fmt.Print("Enter a number: ")
	var number int
	fmt.Scanf("%d", &number)

	if (number % 2 == 0) {
		fmt.Printf("%d is even number\n", number)
	} else {
		fmt.Printf("%d is odd number\n", number)
	}
	
}
//this file contains several examples by Golang
package main

import (
	"fmt"
)

func main() {

	checkNumberIsEvenOrOdd()
	
}

func checkNumberIsEvenOrOdd() {

	fmt.Print("Enter a number: ")
	var number int
	fmt.Scanf("%d", &number)

	if (number % 2 == 0) {
		fmt.Printf("%d is even number\n", number)
	} else {
		fmt.Printf("%d is odd number\n", number)
	}

}

Refactor code, move the code in main function to the other function
Refactor code, move the code in main function to the other function
