# Difference between structured and unstructured programming

• Last Updated : 13 Jul, 2021

Structured Programming

• Structured Programming is a type of programming that generally converts large or complex programs into more manageable and small pieces of code.
• These small pieces of codes are usually known as functions or modules or sub-programs of large complex programs.
• It is known as modular programming and minimizes the chances of function affecting another.

Below is the program to illustrate the structured programming:

## C

 `// C program to demonstrate the` `// structured programming` `#include `   `// Function for addition` `int` `sum(``int` `a, ``int` `b)` `{` `    ``return` `a + b;` `}`   `// Function for Subtraction` `int` `sub(``int` `a, ``int` `b)` `{` `    ``return` `a - b;` `}`   `// Driver Code` `int` `main()` `{` `    ``// Variable initialisation` `    ``int` `a = 10, b = 5;`   `    ``int` `add, minus;`   `    ``// Function Call` `    ``add = sum(a, b);` `    ``minus = sub(a, b);`   `    ``printf``(``"Addition = %d\n"``, add);` `    ``printf``(``"Subtraction = %d\n"``, minus);` `    ``return` `0;` `}`

Output:

```Addition = 15
Subtraction = 5```

Unstructured Programming:

• Unstructured Programming is a type of programming that generally executes in sequential order i.e., these programs just not jumped from any line of code and each line gets executed sequentially.
• It is also known as non-structured programming that is capable of creating turning-complete algorithms.

Below is the program to illustrate the unstructured programming:

## C

 `// C program to demonstrate the` `// unstructured programming`   `#include `   `// Driver Code` `int` `main()` `{` `    ``// Variable initialisation` `    ``int` `a = 10, b = 5;` `    ``int` `add, minus;`   `    ``// Operations performed` `    ``add = a + b;` `    ``minus = a - b;`   `    ``printf``(``"Addition = %d\n"``, add);` `    ``printf``(``"Subtraction = %d\n"``, minus);` `    ``return` `0;` `}`

Output:

```Addition = 15
Subtraction = 5```

Tabular difference between structured vs unstructured programming:

My Personal Notes arrow_drop_up
Recommended Articles
Page :