Structured Programming
Structured Programming
Structured programming is a way of writing programs in a clear and organized manner. Instead of
writing the entire program as one long piece of code, we divide it into smaller, logical parts called
functions or modules. This makes the program easier to understand, write, and fix when there are
errors.
3. Control Structures:
o Sequence: Instructions are executed one after another in order.
o Decision Making (Selection): The program decides what to do based on conditions
(e.g., "if it rains, take an umbrella").
o Repetition (Loops): The program repeats certain steps (e.g., counting from 1 to 10).
Easy to Understand
Reusability
Time-Saving
Structured programming in C is like solving a big problem step by step. By dividing the work into
smaller parts, following a logical order, and avoiding unnecessary jumps (like GOTO), it makes
programs easy to write, understand, and fix.
Sequence means that the instructions in a program are executed one after another, in the
same order as they appear. It’s like following steps in a recipe—each step must be completed
before moving on to the next.
In programming, a sequence often involves three basic operations:
1. Input
Getting data from the user.
o
Example: Asking the user to enter their name, marks, or age.
o
2. Assignment
o Storing or processing the data (calculations or storing values in variables).
o Example: Adding two numbers and storing the result.
3. Output
o Displaying the result or processed data to the user.
o Example: Showing the total marks or saying "Hello" to the user.
Example
#include <stdio.h>
int main() {
getch();
return 0;