imperative vs declarative/functional programming

Imper­a­tive Pro­gram­ming : It spec­i­fies a series of instruc­tions that the com­puter exe­cutes in sequence. For exam­ple, the fol­low­ing func­tion uses imper­a­tive approach for find­ing the square of each ele­ment in the given array. Declarative…