Created
October 18, 2015 18:56
-
-
Save OakRaven/ab26f6c42598df60cbdc to your computer and use it in GitHub Desktop.
Submission of Module 3 - Assignment
This file contains 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
open System | |
let GoldenRatio = (1.0 + Math.Sqrt(5.0)) / 2.0 | |
let GetValues = | |
Console.Write("How many numbers would you like to enter? ") | |
let count = Console.ReadLine(); | |
let count = int count | |
let values = [ | |
if count > 0 then | |
for i = 1 to count do | |
Console.Write(String.Format("Enter value #{0}: ", i)); | |
let value = Console.ReadLine() | |
yield (float value) ] | |
values | |
let CalculateGoldenRatio value = | |
value * GoldenRatio | |
let GetGoldenRatioTuples (values : list<float>) = | |
[ | |
for i in values do | |
yield (i, (CalculateGoldenRatio i)) ] | |
[<EntryPoint>] | |
let main argv = | |
let values = GetValues | |
let tuples = GetGoldenRatioTuples values | |
for i = 0 to tuples.Length - 1 do | |
let x, y = tuples.Item(i) | |
Console.WriteLine(String.Format("{0}: {1}", x, y)) | |
Console.ReadKey() | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment