Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 12, 2018 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/cc9c15ae5069b97e4766744c25c11cae to your computer and use it in GitHub Desktop.
Save parzibyte/cc9c15ae5069b97e4766744c25c11cae to your computer and use it in GitHub Desktop.
package main
import (
"strconv"
"fmt"
)
func main(){
binario := "1010101"
entero, error := strconv.ParseInt(binario, 2, 64)
if error != nil {
fmt.Println("Error al convertir: ", error)
}else{
fmt.Printf("El número binario '%s' es %d en su representación decimal", binario, entero)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment