25 26
This commit is contained in:
parent
f917420104
commit
0481f31676
3 changed files with 40 additions and 0 deletions
17
ulohyfs/src/u25.fs
Normal file
17
ulohyfs/src/u25.fs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
module UlohyFs.u25
|
||||||
|
|
||||||
|
open System.IO
|
||||||
|
open System.Text.Unicode
|
||||||
|
open UlohyFs.Attributes
|
||||||
|
open System
|
||||||
|
|
||||||
|
let obraty = [|15;-10;20;45;-90;65;40;78;-81;40;-9;61|]
|
||||||
|
|
||||||
|
[<Uloha(25)>]
|
||||||
|
let uloha25() =
|
||||||
|
let positive = obraty |> Array.filter (fun x -> x > 0) |> Array.sum
|
||||||
|
let negative = obraty |> Array.filter (fun x -> x < 0) |> Array.sum
|
||||||
|
let sum = obraty |> Array.sum
|
||||||
|
printfn "Kladne: %d" positive
|
||||||
|
printfn "Zaporne: %d" negative
|
||||||
|
printfn "Suma: %d" sum
|
21
ulohyfs/src/u26.fs
Normal file
21
ulohyfs/src/u26.fs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
module UlohyFs.u26
|
||||||
|
|
||||||
|
open System.IO
|
||||||
|
open System.Text.Unicode
|
||||||
|
open UlohyFs.Attributes
|
||||||
|
open System
|
||||||
|
|
||||||
|
[<Uloha(26)>]
|
||||||
|
let uloha26() =
|
||||||
|
printfn "zadaj 5 medzerou oddelenych cisel od 1 do 35"
|
||||||
|
let input = Console.ReadLine()
|
||||||
|
let inpint = input.Split(' ') |> Array.map int
|
||||||
|
if inpint.Length <> 5 then
|
||||||
|
printfn "Zle zadane cisla"
|
||||||
|
else
|
||||||
|
let rng = Random()
|
||||||
|
let lotto = [|for i in 1..5 -> rng.Next(1, 36)|]
|
||||||
|
let matches = inpint |> Array.filter (fun x -> lotto |> Array.contains x) |> Array.length
|
||||||
|
printfn "Tvoje cisla: %A" inpint
|
||||||
|
printfn "Vyherne cisla: %A" lotto
|
||||||
|
printfn "Zhoda: %d" matches
|
|
@ -17,6 +17,8 @@
|
||||||
<Compile Include="src\u22.fs" />
|
<Compile Include="src\u22.fs" />
|
||||||
<Compile Include="src\u23.fs" />
|
<Compile Include="src\u23.fs" />
|
||||||
<Compile Include="src\u24.fs" />
|
<Compile Include="src\u24.fs" />
|
||||||
|
<Compile Include="src\u25.fs" />
|
||||||
|
<Compile Include="src\u26.fs" />
|
||||||
<Compile Include="src\u17.fs" />
|
<Compile Include="src\u17.fs" />
|
||||||
<Compile Include="src\u18.fs" />
|
<Compile Include="src\u18.fs" />
|
||||||
<Compile Include="src\u19.fs" />
|
<Compile Include="src\u19.fs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue