I found task, but maybe it found me.
Task to PHP:
"Write a 10x5 table with values from 1-50".
I prefer go so I write in go :)
func main() {
var index int =1
var x=5
var y=10
for i := 0; i < x; i++ {
for j := 0; j < y; j++ {
fmt.Print("___")
}
fmt.Println()
fmt.Print("|")
for j := 0; j < 10; j++ {
strconv.Itoa(index)
fmt.Printf("%2s|",strconv.Itoa(index))
index++
}
fmt.Println()
}
for j := 0; j < 10; j++ {
fmt.Print("___")
}
}
And effect:
Brak komentarzy:
Prześlij komentarz