open Printf
exception Input_Negativo;;

let rec fib x = 
   if (x<0) 
   then raise Input_Negativo 
   else if (x <= 1)
        then 1 
        else fib (x-1) + fib (x-2)

let fich = open_in "dados.txt"
let () = printf "%d\n" (fib (int_of_string (input_line fich)))
let () = close_in fich

This document was generated using caml2html