ghc haskell version and go for e1

This commit is contained in:
Dan Ballard 2014-08-20 22:19:38 -07:00
parent bf1adf6b06
commit 9e2179f2d8
3 changed files with 26 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.exe
*.o
*.swp
*.hi

7
e1/e1.ghc.hs Normal file
View File

@ -0,0 +1,7 @@
import System.IO
sum35 i acc max | i >= max = acc
| rem i 3 == 0 ||rem i 5 == 0 = sum35 (i+1) (acc+i) max
| otherwise = sum35 (i+1) acc max
main = print (sum35 1 0 1000)

15
e1/e1.go Normal file
View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
)
func main() {
sum := 0
for i := 1; i < 1000; i++ {
if i%3 == 0 || i%5 == 0 {
sum += i
}
}
fmt.Println(sum)
}