mirror of https://github.com/01-edu/public.git
4 years ago
2 changed files with 24 additions and 28 deletions
@ -1,24 +0,0 @@
|
||||
package correct |
||||
|
||||
func ConvertNbrBase(n int, base string) string { |
||||
var result string |
||||
length := len(base) |
||||
|
||||
for n >= length { |
||||
result = string(base[(n%length)]) + result |
||||
n = n / length |
||||
} |
||||
result = string(base[n]) + result |
||||
|
||||
return result |
||||
} |
||||
|
||||
func ConvertBase(nbr, baseFrom, baseTo string) string { |
||||
resultIntermediary := AtoiBase(nbr, baseFrom) |
||||
|
||||
resultFinal := ConvertNbrBase(resultIntermediary, baseTo) |
||||
|
||||
return resultFinal |
||||
} |
||||
|
||||
// TODO: fix base exercises
|
Loading…
Reference in new issue