package main

import (
	"fmt"
	"strconv"
)

type Printable interface {
	Number | NumberFloat
	fmt.Stringer
}

type Number struct {
	val int
}

func (num Number) String() string {
	return string(strconv.Itoa(num.val))
}

type NumberFloat struct {
	val float64
}

func (num NumberFloat) String() string {
	return string(strconv.Itoa(int(num.val)))
}

func Print[T Printable](num T) {
	fmt.Println(num)
}

func main() {
	firstTest := Number{val: 5}
	secondTest := NumberFloat{val: 7.2}
	Print(firstTest)
	Print(secondTest)
}
