Created
October 26, 2015 09:56
-
-
Save craigrbruce/cc388a62f4344605ccfa to your computer and use it in GitHub Desktop.
Module 3 Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let calculateRatio x = x * goldenRatio | |
let getValue (index: int32) = | |
Console.WriteLine("Enter value " + index.ToString()); | |
Console.ReadLine() | |
let getValues count = | |
let result = | |
[ for i in 1 .. count -> float(getValue(i))] | |
result | |
[<EntryPoint>] | |
let main argv = | |
Console.Write("How many values would you like to input? ") | |
let valueCount = Int32.Parse(Console.ReadLine()) | |
let values = getValues valueCount | |
let result = | |
[for index in 0 .. (valueCount-1) -> (values.[index], calculateRatio(float values.[index]))] | |
result |> List.iter (fun r -> Console.WriteLine(r)) | |
0 // return an integer exit code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment