From 0481f316761500857ef375c69c4e28b0fbbf44c7 Mon Sep 17 00:00:00 2001 From: davidon-top Date: Tue, 11 Feb 2025 09:09:22 +0100 Subject: [PATCH] 25 26 --- ulohyfs/src/u25.fs | 17 +++++++++++++++++ ulohyfs/src/u26.fs | 21 +++++++++++++++++++++ ulohyfs/ulohyfs.fsproj | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 ulohyfs/src/u25.fs create mode 100644 ulohyfs/src/u26.fs diff --git a/ulohyfs/src/u25.fs b/ulohyfs/src/u25.fs new file mode 100644 index 0000000..d7627ca --- /dev/null +++ b/ulohyfs/src/u25.fs @@ -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|] + +[] +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 \ No newline at end of file diff --git a/ulohyfs/src/u26.fs b/ulohyfs/src/u26.fs new file mode 100644 index 0000000..1d4aeef --- /dev/null +++ b/ulohyfs/src/u26.fs @@ -0,0 +1,21 @@ +module UlohyFs.u26 + +open System.IO +open System.Text.Unicode +open UlohyFs.Attributes +open System + +[] +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 \ No newline at end of file diff --git a/ulohyfs/ulohyfs.fsproj b/ulohyfs/ulohyfs.fsproj index f318fcc..fcf47de 100644 --- a/ulohyfs/ulohyfs.fsproj +++ b/ulohyfs/ulohyfs.fsproj @@ -17,6 +17,8 @@ + +