We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'm trying to explain to Haskell that a triangle is not a stright line. Can anyone help? (The output of the following code is 1 1 1 1 2 1 1 3 3 1 (without any new lines))
-- FORMAT matv=putStr((showv)++" ")-- print value with space -- print tri value at coordspasmn|n==0=1|m==n=1|otherwise=pas(m-1)(n-1)+pas(m-1)n-- print row of triangle rowm=mapM_(mat.(pasm)$)[0..m]-- print triangle until rowtrim=mapM_(row)[0..(m-1)]main=dom<-readLn::IOInttrim-- print tri to row m
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pascal's Triangle
You are viewing a single comment's thread. Return to all comments →
I'm trying to explain to Haskell that a triangle is not a stright line. Can anyone help? (The output of the following code is 1 1 1 1 2 1 1 3 3 1 (without any new lines))