diff --git a/STATUS.md b/STATUS.md index 355f460..4c037f4 100755 --- a/STATUS.md +++ b/STATUS.md @@ -49,7 +49,7 @@ This file is used to track the language used in the current implementations: - [x] MATLAB/Octave - [x] Nim - [x] Objective-C -- [ ] OCaml +- [x] OCaml - [x] Pascal - [x] Perl - [x] PHP diff --git a/ocaml/WesleySafadao.ml b/ocaml/WesleySafadao.ml new file mode 100644 index 0000000..bd5d444 --- /dev/null +++ b/ocaml/WesleySafadao.ml @@ -0,0 +1,5 @@ +let getPercentualSafadeza (day, month, year) = + (1+month)*month/2 + (year/100) * (50 - day) + +let getPercentualAnjo (day, month, year) = + 100 - getPercentualSafadeza (day, month, year) diff --git a/ocaml/WesleySafadaoTest.ml b/ocaml/WesleySafadaoTest.ml new file mode 100644 index 0000000..a7ea5e8 --- /dev/null +++ b/ocaml/WesleySafadaoTest.ml @@ -0,0 +1,11 @@ +#use "WesleySafadao.ml";; + +let main = + let (year, month, day) = (28, 12, 81) in + print_string "Você é "; + print_int ( getPercentualSafadeza (day, month, year) ) ; + print_string "% safado e "; + print_int ( getPercentualAnjo (day, month, year) ); + print_endline "% anjo" + +let _ = main