Imperative programming is like giving a set of instructions to a robot. In order for the robot to perform tasks, you have to tell it what to do step by step.
Similarly, in imperative programming, the computer follows a set of instructions in a specific order to accomplish a task. You give the computer a list of commands, and it executes them line by line.
Imagine that you are telling a friend how to make a sandwich. You would give a set of steps like "take two bread slices, spread peanut butter on one slice, put jelly on the other slice, put the slices together, and cut the sandwich in half." This is similar to giving commands in a program.
In imperative programming, these sets of instructions are called statements. The statements are executed in order, one after the other, until the program reaches the end of the list of commands.
Some examples of imperative programming languages are C, C++, Java, and Python. In these languages, you tell the computer what to do using statements.
Imperative programming is used in many different applications, such as creating video games, building websites, and developing software for businesses.