list comprehension haskell 001
parent
177e937ccd
commit
1a6d7480ec
|
@ -1,6 +1,4 @@
|
|||
module Main where
|
||||
|
||||
divisible_by_3_or_5 x = (mod x 3 == 0) || (mod x 5 == 0)
|
||||
|
||||
main = do
|
||||
print (sum (filter divisible_by_3_or_5 [1..999]))
|
||||
print $ sum [x | x <- [1..999], mod x 3 == 0 || mod x 5 == 0]
|
||||
|
|
Loading…
Reference in New Issue