Source

spoj-ocaml / 00024.FCTRL2 / fctrl2.ml

(* http://www.spoj.pl/problems/FCTRL2/ *)

open Num

let id x = x
let (|>) x y = y x


let rec fact = function
    0 -> num_of_int 1
  | n -> num_of_int n */ fact (n - 1)

let main () =
  let t = Scanf.scanf "%d\n" id in
  for i = 1 to t do
    Scanf.scanf "%d\n" id |> fact |> string_of_num |> print_endline
  done

let () = main ()