Write functions code

The file is edited by place the solution of the problem...