File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ module github.com/NotBalds/random_bald
2+
3+ go 1.22.5
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments