Cleanup, update

This commit is contained in:
2022-04-24 00:58:05 +02:00
parent e63c20719f
commit 9b544600d8
9 changed files with 211 additions and 60 deletions
+7
View File
@@ -8,7 +8,14 @@ let rec fib n =
| 1 -> 1
| _ -> fib (n-1) + fib (n-2)
let rec fibSmart n =
match n with
| n when n < 0 -> failwith (sprintf "Error: %d is less than 0" n)
| (0|1) -> n
| _ -> fibSmart (n-1) + fibSmart (n-2)
// Read from stdin and print result
printfn "Inserisci l'indice del numero di fibonacci che vuoi calcolare:\n"
let i = Console.ReadLine() |> int
printfn "%A" (fib (i))
printfn "%A" (fibSmart (i))
-12
View File
@@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>