go-by-test/roman/roman.go

17 lines
256 B
Go
Raw Normal View History

package roman
import "strings"
func ConvertToRoman(arabic int) string {
var converted strings.Builder
if arabic <= 3 {
for i := 0; i < arabic; i++ {
converted.WriteString("I")
}
}
2024-09-22 18:57:12 +00:00
if arabic == 4 {
return "IV"
}
return converted.String()
}