Pascal's triangle: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 791: | Line 791: | ||
} |
} |
||
</lang> |
</lang> |
||
Funtion to |
Funtion to pretty print it: |
||
<lang scala> |
<lang scala> |
||
def prettytri(r:Int) = (1 to r) foreach {n=>print(" "*(r-n)); tri(n) map (c=>print(c+" ")); println} |
def prettytri(r:Int) = (1 to r) foreach {n=>print(" "*(r-n)); tri(n) map (c=>print(c+" ")); println} |