Functions are sub programs or set of instructions. In regular practice we use to write the program in the main() function. This is only a function in which we enclose the entire body of the program. Suppose programmer would like to do multiple calculations in the program which are of different type. The values out of one calculation may be used for further calculations.
In this case program becomes very large and complicated. Due to this complexity and large size of programs, the modification, maintained and even testing becomes difficult. Instead of writing all coding lines in the main() function itself we can divide our program in to sub parts called as functions.
The following video explains the need of functions: