Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Created June 15, 2016 18:59
Show Gist options
  • Select an option

  • Save narenaryan/b772e6d09fd49636c342ef45c5c7768e to your computer and use it in GitHub Desktop.

Select an option

Save narenaryan/b772e6d09fd49636c342ef45c5c7768e to your computer and use it in GitHub Desktop.
// https://www.hackerrank.com/challenges/plus-minus
package main
import ("fmt"
"bufio"
"os"
"strconv"
"strings"
)
func main() {
inputreader := bufio.NewReader(os.Stdin)
N, _ := inputreader.ReadString('\n')
number, _ := strconv.Atoi(strings.TrimSpace(N))
temp := number
for i := temp; i > 0; i--{
result := fmt.Sprintf("%*s", temp, "#")
for j := temp; j < number; j++{
result += "#"
}
fmt.Println(result)
temp--
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment