0% found this document useful (0 votes)
23 views

Structured Programming

programming

Uploaded by

atul
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Structured Programming

programming

Uploaded by

atul
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

Features of Structured Programming

1. Breaking the Program into Small Parts


o The program is divided into small, independent parts or blocks.
o Each block performs a specific task, like addition, displaying data, or checking a
condition.

2. Step-by-Step Execution (Top-Down Approach):


o The program runs step by step in a logical sequence.
o You can think of it as solving a problem in small steps, one after the other.

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).

Uses of structured programming

Easy to Understand

Easy to Fix Errors

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 structured statement (input/output/assignment)

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.

In C, sequential statements are statements that are executed in the order


they appear in a program. This means that the first statement in a
sequence is executed first, followed by the second, and so on.

Example

#include <stdio.h>

int main() {

int a = 5; // Statement 1: Input

int b = 10; // Statement 2: Input

int sum = a + b; // Statement 3: Computation

printf("The sum is: %d\n", sum); // Statement 4: Output

getch();

return 0;

You might also like