package main

import (
	"Study/pkg/MaxCommFactor"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var nums []int
	var x, y int
	for _, arg := range os.Args[1:] {
		t, err := strconv.ParseInt(arg, 0, 64)
		if err != nil {
			fmt.Fprintln(os.Stderr, "cf:", err)
		}
		nums = append(nums, int(t))
	}
	if len(nums) <= 0 {
		fmt.Println("Please input two numbers in console (one in a row)")
		fmt.Scanln(&x, &y)
	} else if len(nums) == 1 {
		x = nums[0] // 将终端输入的数据赋值给x
		fmt.Println("Please input one numbers in console (one in a row)")
		fmt.Scanln(&y)
	} else {
		x, y = nums[0], nums[1]
	}
	fmt.Print(x, y, " Gcd is ", MaxCommFactor.MaxComm(x, y))
}
