Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Exercise 9 – General (… continued from previous – General)
- // Queation 5
- // Year of
- open System
- let yearOf(x:int):int=
- let (year400:int) = (x - 1) / (400 * 365 + 97)
- let y = (x - 1) % (400 * 365 + 97)
- let (year100:int) = y / (100 * 365 + 24)
- let z = y % (100 * 365 + 24)
- let (year4:int) = z / (4*365 + 1)
- let w = z % (4*365 + 1)
- let (year1:int) = w / 365
- let mutable year = year400*400 + year100*100 + year4*4 + year1 + 1
- if year = 4 then year <- year - 1
- year
- printfn "%i" (yearOf(654415))
- Console.ReadKey() |> ignore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement