From adbcc59b30a7a5aac9f734c4c594b6c31807ccee Mon Sep 17 00:00:00 2001 From: Isaac Douglas Date: Sun, 31 Oct 2021 22:34:10 -0300 Subject: [PATCH] add Factors.hs --- src/Maths/Factors.hs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/Maths/Factors.hs diff --git a/src/Maths/Factors.hs b/src/Maths/Factors.hs new file mode 100644 index 0000000..324fa1c --- /dev/null +++ b/src/Maths/Factors.hs @@ -0,0 +1,8 @@ +module Maths.Factors where + +factors :: Int -> [Int] +factors num = [x | x <- [1 .. num], num `mod` x == 0] + +main :: IO () +main = do + print (factors 28) \ No newline at end of file