You are viewing a single comment's thread. Return to all comments →
Haskell
pascal n = take n $ iterate nextPascal [1] where nextPascal l = [head l] ++ [a + b | (a, b) <- zip l (tail l)] ++ [last l] pascalStr n = map (unwords . map show) $ pascal n main = do n <- read <$> getLine putStrLn . unlines $ pascalStr n
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 →
Haskell