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
About the author
- 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
Comments
Join the discussionNo comments yet. Be the first to comment.



