Commit 4a62b4de by mushishixian

fix

parent 7d7efad3
Showing with 2 additions and 49 deletions
package main
import (
<<<<<<< HEAD
"bytes"
"fmt"
)
func intsToString(values []int) string {
var buf bytes.Buffer
buf.WriteByte('[')
for i, v := range values {
if i > 0 {
buf.WriteString(", ")
}
fmt.Fprintf(&buf, "%d", v)
}
buf.WriteByte(']')
return buf.String()
}
func main() {
fmt.Println(intsToString([]int{1, 2, 3})) // "[1, 2, 3]"
=======
"fmt"
"strconv"
)
func main() {
var a,b,c float64
a=1.69*100
b=1.7*10
c=a*b/(100*10)
//ȷ2.873
fmt.Println(c)
//fmt.Println(fmt.Sprintf("%.2f",c))
//fmt.Println(FloatRound(c,2))
}
// ȡСλ
func FloatRound(f float64, n int) float64 {
format := "%." + strconv.Itoa(n) + "f"
//fmt.Println(format)
res, _ := strconv.ParseFloat(fmt.Sprintf(format, f), 64)
return res
>>>>>>> 326ae7ed67d5d2db331dddd1277d36b8b1992b08
}
\ No newline at end of file
package main
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment