Skip to main content

Command Palette

Search for a command to run...

Numeral systems - hexadecimal

Updated
1 min readView as Markdown
S
DevRel at StackGen | Formerly at Deepfence ,Tenable , Accurics | AWS Community Builder also Docker Community Award Winner at Dockercon2020 | CyberSecurity Innovator of Year 2023 award by Bsides Bangalore | Docker/HashiCorp Meetup Organiser Bangalore & Co-Author of Learn Lightweight Kubernetes with k3s (2019) , Packt Publication & also run Non Profit CloudNativeFolks / CloudSecCorner Community To Empower Free Education reach out me twitterhttps://twitter.com/sangamtwts or just follow on GitHub -> https://github.com/sangam14 for Valuable Resources
        package main

        import "fmt"

        func main() {
            //    fmt.Printf("%d - %b - %x \n", 42, 42, 42)
           //    fmt.Printf("%d - %b - %#x \n", 42, 42, 42)
          //    fmt.Printf("%d - %b - %#X \n", 42, 42, 42)
            fmt.Printf("%d \t %b \t %#X \n", 42, 42, 42)
       }

Run{:.button.button--outline-success.button--pill}

output:

```   
   42      101010      0X2A 
```

in above program the annotation verb %x formats a number in hexadecimal Ex:- which represent 0X2A ( base 16 format)

integer to hexadecimal cheatsheet:

%x    base 16, with lower-case letters for a-f
    %x    base 16, with upper-case letters for a-f
15 views

GopherLabs

Part 1 of 50

Ultimate Series of Blogs for All Golang Developer

More from this blog

C

CloudNativeFolks Community

140 posts

CloudNativeFolks is non profit community that empower and educate about cloud native technology !