while循环

课程:golang · 编程练习

Go编程练习 - while循环

练习内容

package main\n\nimport "fmt"\n\nfunc main() {\n total := 0\n count := 1\n\n for count <= 10 {\n total += count\n count++\n }\n\n fmt.Println("1到10的和是:", total)\n}\n\n