package main

import (
    "fmt"
    "strconv"
)

func converToBianry(n int) string {
    result := ""
    for ; n > 0; n /= 2 {
        lsb := n % 2
        result = strconv.Itoa(lsb) + result     
    }
    return result
}

func main() {

    fmt.Println(
        converToBianry(3),
        converToBianry(5),
        converToBianry(100),
    )

}
取模反向加

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2021-04-19
  • 2021-12-22
猜你喜欢
  • 2021-11-25
  • 2021-12-23
  • 2020-02-15
  • 2022-12-23
  • 2018-10-04
  • 2021-12-23
相关资源
相似解决方案