You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Tiago Collot a17d6662eb feat(digitlen): add README.md for Go Exam exercise digitlen 1 year ago
..
README.md feat(digitlen): add README.md for Go Exam exercise digitlen 1 year ago

README.md

digitlen

Instructions

Write a function DigitLen() that takes two integers as arguments and returns the number of digits in the first int by the base of the second int.

  • The second int must be between 2 and 36. If not, the function returns -1.
  • If the first int is negative, reverse the sign and count the digits.

Expected function

func DigitLen(n,base int) int {

}

Usage

Here is a possible program to test your function:

package main

import (
	"fmt"
	"piscine"
)

func main() {
	fmt.Println(piscine.DigitLen(100, 10))
	fmt.Println(piscine.DigitLen(100, 2))
	fmt.Println(piscine.DigitLen(-100, 16))
	fmt.Println(piscine.DigitLen(100, -1))
}

And its output:

$ go run . | cat -e
3
7
2
-1