初始化

This commit is contained in:
2025-04-08 17:01:19 +08:00
commit 4228f447f7
75 changed files with 574 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
module operators
go 1.23.5

View File

@@ -0,0 +1,29 @@
package main
import "fmt"
func main() {
a, b := 15, 10
// 算术运算符
sum := a + b
diff := a - b
product := a * b
quotient := a / b
remainder := a % b
// 比较运算符
eq := a == b
gt := a > b
lt := a < b
fmt.Println("运算符示例:")
fmt.Printf("%d + %d = %d\n", a, b, sum)
fmt.Printf("%d - %d = %d\n", a, b, diff)
fmt.Printf("%d * %d = %d\n", a, b, product)
fmt.Printf("%d / %d = %d\n", a, b, quotient)
fmt.Printf("%d %% %d = %d\n", a, b, remainder)
fmt.Printf("%d == %d: %t\n", a, b, eq)
fmt.Printf("%d > %d: %t\n", a, b, gt)
fmt.Printf("%d < %d: %t\n", a, b, lt)
}