Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- let findMax l = l |> List.fold (fun maxValue x -> if x > maxValue && x%2 = 0 then x else maxValue) -1
- [<EntryPoint>]
- let main argv =
- let RND = new Random()
- let m = [
- let n = RND.Next(7,17)
- for k in 1..n do
- yield RND.Next(0,100)
- ]
- // let m = [for k in 1..5 do k*2+1] // odd test
- printfn "%A\nMax even number: %A" m (findMax m)
- 0 // return an integer exit code
Add Comment
Please, Sign In to add comment