-
-
Save anarcher/066fb9cfb7dd19af493b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Euler01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
sum := 0 | |
for i := 0 ; i < 1000 ; i ++ { | |
if i % 3 == 0 || i % 5 == 0 { | |
sum = sum + i | |
} | |
} | |
fmt.Printf("sum:%v\n",sum) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> (0 /: (1 until 1000))( (x,y) => if ( y %3 == 0 || y % 5 == 0 ) x+y else x ) | |
res43: Int = 233168 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment