[CHALLENGE] Write a program which will print out a Pascal triangle | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

[CHALLENGE] Write a program which will print out a Pascal triangle

I've found this interesting challenge online, so I want to share it with you :) . In Pascal's triangle, each number is the sum of the two numbers directly above it. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 You can read about the Pascal triangle on Wikipedia: https://en.m.wikipedia.org/wiki/Pascal's_triangle Good luck all :)

7th Mar 2018, 7:20 AM
stn
stn - avatar
10 Answers
8th Mar 2018, 10:52 AM
Infinity
Infinity - avatar
+ 5
Found a new challenge, Make it a assignment. https://www.sololearn.com/discuss/1082512/?ref=app
7th Mar 2018, 7:48 AM
Akash Pal
Akash Pal - avatar
+ 5
Mine: https://code.sololearn.com/cOn4XSTlg8Db/#py I think this challenge would be easily accepted in lesson factory :)
7th Mar 2018, 8:18 PM
Pedro Demingos
Pedro Demingos - avatar
+ 4
Here's a solution in Haskell: import Control.Monad import Data.List main = mapM_ print $ take 10 xss where xss = iterate f [] sum = ap (zipWith (+)) tail f xs = (1 : sum xs) ++ [1] https://tio.run/##LYy7CoNAFET7/YopUiiCxDZglZSxthAJF7LixX2xe0MkP7/ZSKabM4@V0qaNyZlt8FFw9U6iN@3gHT3VH95IqL1zEqUssUMPS2F4IER2ghOENo3ujD0lvFcdtULRz/Vg0ZFEY8E0Hzi9bMEUUH04jCwrqqauywebI1/KsBSqDpeju6caTYOpm3P@Ag
7th Mar 2018, 7:35 AM
Schindlabua
Schindlabua - avatar
+ 3
https://code.sololearn.com/c61wEND4rz5C/?ref=app
14th Mar 2018, 4:00 PM
tamaslud
tamaslud - avatar
+ 2
https://code.sololearn.com/c0q5FK2hn4rV/?ref=app
7th Mar 2018, 2:46 PM
Arun
7th Mar 2018, 4:47 PM
hinanawi
hinanawi - avatar
+ 2
Cool idea!
9th Mar 2018, 7:20 PM
dieserrapha
dieserrapha - avatar
8th Mar 2018, 12:03 PM
Aaron Stone
Aaron Stone - avatar