Selft training repo
Imperative programming focuses on explicitly specifying a sequence of statements that modify program state. It emphasizes how to achieve a result through step-by-step instructions and control flow structures like loops and conditionals.
Procedural programming and structured programming are subsets of imperative programming.
Procedural and object-oriented programming (OOP) languages fall under imperative programming, such as C, C++, C#, and Java.
The example calculates the sum of numbers from 1 to 10 using a for loop in Java.
int sum = 0;
for (int i = 1; i <= 10; i++) {
sum += i;
}
System.out.println("Sum: " + sum);
Declarative style is a contrast to the Imperative style