package main
import "fmt"
func main(){
var a int
a = 100
var b int
b = 2
per := float32(b/a)
fmt.Printf("打印百分比: %.2f%%\n",per)
truePer := float32(b)/float32(a)
fmt.Printf("真正可以打印百分比的: %.2f%%",truePer)
}
标签:百分比,int,fmt,小数点,per,Golang,%.,为数,float32
来源: https://www.cnblogs.com/shangmo/p/15601432.html