Imperative programming emphasizes writing a clear set of instructions to tell the computer how to perform tasks. It describes computation in terms of statements that alter the state of the program. Imperative programs can be viewed as programming commands or mathematical assertions. the order of execution is very important and uses both mutable and immutable data.
Examples: Cobol, Java, C, C++.
Declarative programming focuses on describing the outcome of what you want. It expresses a computation’s logic (what to do) without describing its control flow (how to do it). In declarative programming, variables are typically immutable.
Examples: React, Regular expressions, CSS, SQL (SELECT queries), HTML, XSLT, and many others
Day to day example:
Imperative goes to a restaurant and orders a fully cooked omelet of three eggs, fries with ketchup, a side salad with ranch, and a Pepsi with no ice. The waiter delivered exactly what was asked for and charged $16.00 for the meal
On the other hand, Declarative goes to a restaurant and tells the waiter that he only wants to pay around $10 for a meal and wants an omelet. The waiter returns with a 2 egg omelet, a side of mashed potatoes, a dinner roll, and a glass of water. He’s charged $9.99.