Skip to content
Procedural Programming — Explained with Examples

Procedural Programming — Explained with Examples

DodaTech Updated Jun 15, 2026 2 min read

Procedural programming is a programming paradigm that organizes code into procedures (also called functions or subroutines) that perform specific tasks. The program executes as a series of sequential steps, with procedures called as needed. It is a subtype of Declarative vs Imperative imperative programming.

Pioneered by languages like C, Pascal, and FORTRAN, procedural programming centers on the concept of modularity through functions. Data is typically separate from the functions that operate on it (unlike OOP where data and behavior are bundled). Key features include structured control flow (loops, conditionals, sequencing) and scope (local and global variables). Procedural programming is intuitive for beginners because code executes from top to bottom, mirroring how humans often think about step-by-step processes.

Real-world analogy. Procedural programming is like assembling furniture with a manual. Step 1: Open box. Step 2: Attach leg A to frame B. Step 3: Tighten screws. Each step is a clear instruction. You follow them in order, calling back to earlier steps when needed (“repeat step 4 for the remaining legs”).

Example (C — procedural):

#include <stdio.h>

int factorial(int n) {
    int result = 1;
    for (int i = 1; i <= n; i++) {
        result *= i;
    }
    return result;
}

int main() {
    printf("%d\n", factorial(5));  // 120
    return 0;
}

Related terms: OOP, Declarative vs Imperative, Functional Programming, Data-Driven Programming, Event-Driven Programming

Related tutorial: Procedural vs OOP

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro