22 lines
336 B
Go
22 lines
336 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"strconv"
|
||
|
|
||
|
"gogs.bullercodeworks.com/brian/pascal"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
if len(os.Args) == 2 {
|
||
|
if num, err := strconv.Atoi(os.Args[1]); err == nil {
|
||
|
ret := pascal.Triangle(num)
|
||
|
for i := range ret {
|
||
|
fmt.Println(ret[i])
|
||
|
}
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
fmt.Println("Usage: ./pascal_printer <depth>")
|
||
|
}
|