0% found this document useful (0 votes)
3 views14 pages

Control Structures

Control structures are blocks of code that manage the flow of execution in a program, dictating the order of statement execution based on conditions. There are three main types: Sequential Structure, Selection Structure (Conditional Statements), and Repetition Structure (Loops). Each type has specific syntax and examples, including various conditional statements and loop types in the C language.

Uploaded by

freefireneeww
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views14 pages

Control Structures

Control structures are blocks of code that manage the flow of execution in a program, dictating the order of statement execution based on conditions. There are three main types: Sequential Structure, Selection Structure (Conditional Statements), and Repetition Structure (Loops). Each type has specific syntax and examples, including various conditional statements and loop types in the C language.

Uploaded by

freefireneeww
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROGRAM CONTROL STRUCTURES

A control structure is a block of code that manages the flow


of execution in a program.

Control structures dictate the order in which statements are


executed based on certain conditions.

Types of control structures:

1. Sequential Structure

2. Selection Structure (Conditional Statements)

3. Repetition Structure (Loops)

Sequential Structure

 The default structure where statements are executed


one after the other in sequence.

 Example:
Selection Structure (Conditional Statements)

 Allows the program to make decisions and execute


different blocks of code based on specified conditions.

 All conditional statements available in C language are


mentioned below:

1. if statement

2. if else
3. ladder if else if………else
4. nested if

5. ternary

6. switch case
Syntax of if else statement
Syntax of a ladder if else statement
Syntax of a nested if else statement
Syntax of ternary conditional statement
Repetition Structure (Loops):

 Allows the execution of a block of code repeatedly as


long as a specified condition is true.

 Types of loops in C language are mentioned below:

1. Entry Controlled Loop: while loop, and for loop

2. Exit Controlled Loop: do while loop

Syntax of a while loop


Syntax of a do while loop
Syntax of for loop

You might also like