Skip to content

Instantly share code, notes, and snippets.

@ranapu
Created March 30, 2017 13:22
Show Gist options
  • Save ranapu/91b6d66e54600dcc78d454c188978b09 to your computer and use it in GitHub Desktop.
Save ranapu/91b6d66e54600dcc78d454c188978b09 to your computer and use it in GitHub Desktop.
Staircase in Go
package main
import "fmt"
func main() {
var n int
fmt.Scan(&n)
for i := 1; i <= n; i++ {
for j := 0; j < n-i; j++ {
fmt.Print(" ")
}
for j := 0; j < n-(n-i); j++ {
fmt.Print("#")
}
fmt.Println()
}
fmt.Scan(&n)
for i := 1; i <= n; i++ {
for j := 1; j < n - i; j++ {
fmt.Print(" ")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment