Added the commented program of the two functions + examples of application