Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Exercise 7 – General
- // Leap Year
- // Question 1
- open System
- let isleap (y:int):bool =
- if y % 400 = 0 then true
- else if y % 4 = 0 && y % 100 > 0 then true
- else false
- printfn "%b" (isleap(2021))
- Console.ReadKey() |> ignore
- // Question 2
- // Days to end Year
- open System
- let isleap (y:int):bool =
- if y % 400 = 0 then true
- else if y % 4 = 0 && y % 100 > 0 then true
- else false
- let daysToEndYear (year:int) : int=
- let mutable days = 365*year
- for i in [1..year] do
- if (isleap(i)) = true then days <- days+1
- days
- printfn "%i" (daysToEndYear(1792))
- Console.ReadKey() |> ignore
Add Comment
Please, Sign In to add comment