Explorar o código

add new go file go/l2.go for one math operation

root hai 1 mes
pai
achega
59dfe50ae8
Modificáronse 1 ficheiros con 26 adicións e 0 borrados
  1. 26 0
      go/l2.go

+ 26 - 0
go/l2.go

@@ -0,0 +1,26 @@
+package main
+import (
+	"fmt"
+)
+func polz() {
+	fmt.Println("Первое число ")
+	var x1 int
+	fmt.Scan(&x1)
+	fmt.Println("Второе число ")
+	var x2 int
+	fmt.Scan(&x2)
+	x3 := x1+x2
+	fmt.Println(x1 , "+" , x2 , "=" , x3)
+}
+func main() {
+	for {
+		fmt.Println("1. Начать\n2. Закончить")
+		var choise int
+		fmt.Scan(&choise)
+		if choise == 1 {
+			polz()
+		} else if choise == 2 {
+			return
+		}
+	}
+}