package main

import "fmt"

func main() {
	// minimumFromFour()
	// fmt.Println(fibonacci(9))
	// ExampleMyPrint()
	// ExampleExpandSlice1()
	// ExampleExpandSlice2()
	a, b := sumInt(1, 2, 3)
	fmt.Println(a, b)
}

func minimumFromFour() int {
	var min, val int
	fmt.Scan(&min)
	for i := 0; i < 3; i++ {
		fmt.Scan(&val)
		if val < min {
			min = val
		}
	}
	return min
}

func vote(x int, y int, z int) int {
	if (x + y + z) >= 2 {
		return 1
	} else {
		return 0
	}
}

func fibonacci(n int) int {
	var fn int
	var f1, f2 = 1, 1

	if n == 1 || n == 2 {
		return 1
	}
	for i := 2; i < n; i++ {
		fn = f1 + f2
		f1 = f2
		f2 = fn
	}
	return fn
}

func myPrint(a ...interface{}) {
	for _, elem := range a {
		fmt.Printf("%v ", elem)
	}
}

func ExampleMyPrint() {
	myPrint(1, "Hello", 3.14, true)
}

func ExampleExpandSlice1() {
	s := []interface{}{1, 2, 3, 4, 5}

	fmt.Println(s)
	fmt.Println(s...)
}

func ExampleExpandSlice2() {
	s1 := []int{1, 2, 3, 4, 5}
	s2 := []int{6, 7, 8, 9, 10}

	s1 = append(s1, s2...)
	fmt.Println(s1)
}

func sumInt(n ...int) (int, int) {
	var sum int
	for _, elem := range n {
		sum += elem
	}
	return len(n), sum
}
