noctual

Задание 3

Jun 13th, 2021 (edited)
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.42 KB | None | 0 0
  1. open System
  2.  
  3. let findMax l = l |> List.fold (fun maxValue x -> if x > maxValue && x%2 = 0 then x else maxValue) -1
  4.  
  5. [<EntryPoint>]
  6. let main argv =
  7.     let RND = new Random()
  8.     let m = [
  9.         let n = RND.Next(7,17)
  10.         for k in 1..n do
  11.         yield RND.Next(0,100)
  12.     ]
  13.     // let m = [for k in 1..5 do k*2+1] // odd test
  14.     printfn "%A\nMax even number: %A" m (findMax m)
  15.     0 // return an integer exit code
Add Comment
Please, Sign In to add comment