Format the number 7/8 as a decimal with 2 places: 0.88
ocaml Printf.printf "%4.2f" (7. /. 8.);;
Printf.printf "%4.2f" (7. /. 8.);;
ocaml let s = Printf.sprintf "%4.2f" (7. /. 8.) in
print_string s;;
let s = Printf.sprintf "%4.2f" (7. /. 8.) in
print_string s;;
Submit a new solution for
ocaml
There are 29 other solutions in
additional languages (
clojure,
cpp,
csharp,
erlang ...)