package main

import "fmt"

func human(bytes float64) string {
	units := []string{"B", "KiB", "MiB", "GiB", "TiB"}
	i := 0
	for bytes >= 1024 && i < len(units)-1 {
		bytes /= 1024
		i++
	}
	return fmt.Sprintf("%.1f %s", bytes, units[i])
}

// Funkcja może zwrócić więcej niż jedną wartość
func split(total, part int) (percent, rest int) {
	return part * 100 / total, total - part
}

// ...int przyjmuje dowolną liczbę wartości
func sum(numbers ...int) int {
	s := 0
	for _, n := range numbers {
		s += n
	}
	return s
}

func main() {
	fmt.Println(human(900))
	fmt.Println(human(52428800))
	percent, rest := split(120, 93)
	fmt.Println("zajęte:", percent, "procent, wolne:", rest)
	fmt.Println(sum(8, 8, 12, 1))
}
