#pattern exercise
10 messages · Page 1 of 1 (latest)
yes, it was that indeed but
import "fmt"
func main() {
var n int
fmt.Println("Inserisci un numero intero: ")
fmt.Scan(&n)
if n < 1 {
fmt.Println("Spiacente, il numero inserito è < di 1")
}
for row := 1; row <= n*2; row++ {
for col := 1; col < n*2; col++ {
if row == 1 && col < n || row == n*2 && col > n || col == n || row > n && row == col || row < n && row == col {
fmt.Printf("*")
} else {
fmt.Printf(" ")
}
}
fmt.Println()
}
}```
with the following code the moment I've tried it
* *
* *
**
*
**
* *
* *
* *
*****```
this is the result
in the second triangle
it doesn't touch with the bottom