Advertisement
vencinachev

PrintFigures

Nov 18th, 2020
1,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Print Figures
  2. main :: IO()
  3. main = do
  4.     line1 <- getLine
  5.     let a = read line1 :: Int
  6.     printTriangle a
  7.     printTriangle2 a a
  8.  
  9.  
  10. printTriangle :: Int -> IO()
  11. printTriangle 0 = putStr ""
  12. printTriangle n = do
  13.      putStrLn (replicate n '*')
  14.      printTriangle (n-1)
  15.  
  16. printTriangle2 :: Int -> Int -> IO()
  17. printTriangle2 0 _ = putStr ""
  18. printTriangle2 n m = do
  19.     putStrLn (replicate (m-n+1) '*')
  20.     printTriangle2 (n-1) m
  21.  
  22.  
  23.  
  24.  
  25.  
  26.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement