for
This commit is contained in:
parent
64764a6c9f
commit
03a9b0363a
|
|
@ -0,0 +1,24 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
t := 0
|
||||||
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
rows := r.Intn(100)
|
||||||
|
for x := 1; x <= rows; x++ {
|
||||||
|
if x > rows/2 {
|
||||||
|
t--
|
||||||
|
} else {
|
||||||
|
t++
|
||||||
|
}
|
||||||
|
for y := 0; y < t; y++ {
|
||||||
|
fmt.Print("*")
|
||||||
|
}
|
||||||
|
fmt.Print("\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
流程控制学习
|
||||||
Loading…
Reference in New Issue