Skip to content

Commit fcc5c86

Browse files
committed
Initial commit
0 parents  commit fcc5c86

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/NotBalds/random_bald
2+
3+
go 1.22.5

main.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"math/rand"
6+
"strconv"
7+
"time"
8+
)
9+
10+
func printText(text string) {
11+
for _, i := range text {
12+
fmt.Print(string(i))
13+
time.Sleep(time.Millisecond * 40)
14+
}
15+
fmt.Print("\n")
16+
}
17+
18+
func main() {
19+
printText("Random bald generator!")
20+
time.Sleep(time.Second)
21+
fmt.Println()
22+
fmt.Println()
23+
var bald [5]int
24+
var res int = 0
25+
for i := range bald {
26+
bald[i] = rand.Intn(100)
27+
res += bald[i]
28+
}
29+
printText("You are " + strconv.Itoa(bald[0]) + "% bald")
30+
printText("Your sister is " + strconv.Itoa(bald[1]) + "% bald")
31+
printText("Your brother is " + strconv.Itoa(bald[2]) + "% bald")
32+
printText("Your dog is " + strconv.Itoa(bald[3]) + "% bald")
33+
printText("Your cat is " + strconv.Itoa(bald[4]) + "% bald")
34+
35+
printText("My rating: " + strconv.Itoa(res) + "%!")
36+
fmt.Println()
37+
fmt.Println()
38+
}

0 commit comments

Comments
 (0)