0 people like it.

Project Euler 1 - While Loop

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
let pe1_while limit = 
    let mutable acc = 0
    let mutable x = 0
    while x < limit do
        if x % 5 = 0 || x % 3 = 0 then acc <- acc + x
        x <- x + 1
    acc

pe1_while 1000
val pe1_while : limit:int -> int

Full name: Script.pe1_while
val limit : int
val mutable acc : int
val mutable x : int
Raw view Test code New version

More information

Link:http://fssnip.net/2v
Posted:15 years ago
Author:
Tags: