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.
UPDATE: The program now prints a nested array. Still trying to get Haskell to format basic output? (Output of below is [[1],[1,1],[1,2,1],[1,3,3,1]])
-- 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=map(pasm)[0..m]-- print triangle until rowtrim=map(row)[0..(m-1)]main=dom<-readLn::IOIntprint(trim)-- 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 →
UPDATE: The program now prints a nested array. Still trying to get Haskell to format basic output? (Output of below is [[1],[1,1],[1,2,1],[1,3,3,1]])