SlideShare a Scribd company logo
2
Most read
4
Most read
5
Most read
Presented By,
SWASTIKA TRIPATHI
 Repeating important sections of the program.
 Selecting between optional section of a program
Decision
Making
Statement
Decision
Making and
Branching
IF Statement
SWITCH
Statement
Conditional
Operator
Statement
GOTO
Statement
Decision
Making and
Looping
The WHILE
Loop
The do-while
Loop
The FOR
Loop
• DECISION MAKING AND BRANCHING
 In programming the order of execution of instructions may
have to be changed depending on certain conditions.
 This involves a kind of decision making to see whether a
particular condition has occurred or not and then direct the
computer to execute certain instructions accordingly.
• DECISION MAKING AND LOOPING
 Execution of the statement or set of statement repeatedly is
known as LOOPING.
 This may be executed a specified number of times and this
depends on the satisfaction of a test condition.
 A program loop is made up of two parts one part is known as
body of the loop and the other is known as control condition.
 Depending on the control condition statement , the statements
within the loop may be executed.
 The IF statement is the powerful decision making
statement and is used to control the flow of execution of
the statements.
 When decision making in a program they are simply the
result of computation in which the final result is either
TRUE or FALSE.
 The value zero (0) is considered to be FALSE in program.
Any positive or negative value is considered to be TRUE.
Levels of complexity for IF:
1.Simple IF statement
2.IF…..ELSE statement
3.NESTED IF…..ELSE statement
4.ELSE…..IF ladder
It is used to control the flow of execution of the
statements and also to test logically whether the
condition is true or false.
Syntax:
if (condition)
{
statement ;
}
If the condition is true then the statement following
the “if” is executed if it is false then the statement is
skipped.
( Flow chart of Simple if statement )
Test
Condition
Executable X - Statement
TRUE
The if…..else statement is an extension of the simple if
statement.
Syntax:
if (condition)
{
statement 1; (if the condition is TRUE this statement will be executed)
}
else
{
statement 2; (if the condition is FALSE this statement will be executed)
}
It is used to execute some statements when the
condition is true and execute some other statements
when the condition is false depending on the logical
test.
( Flow chart of if…..else statement )
Test
Condition
Executable X - StatementExecutable Y - Statement
TRUEFALSE
 When a series of if…..else statements are occurred in a program, we can write
an entire if…..else statement in another if…..else statement called NESTING.
Syntax:
If (condition 1)
{
if (condition 2)
{
statement 1;
}
else
{
statement 2;
}
}
else
{
if (condition 3)
statement 3;
else
statement 4;
}
Test
Condition-1
Test
Condition-1
Statement-2 Statement-3
Statement-3 Statement-4
( Flow chart of nested if……else
statement )
TRUE
TRUE
FALSE
FALSE
Test
Condition-3
FALSE TRUE
When a series of decisions are involved we have to use more than one
if…..else statement called as multiple if’s. Multiple if…..else statements
are much faster than a series of if…..else statements, since their
structure when any of the condition is satisfied.
Syntax:
if (condition 1)
statement 1;
else if (condition 2)
statement 2;
else if (condition 3)
statement 3;
----------------
----------------
else if (condition n)
statement n;
else
statement x;
( Flow chart of else…..if ladder )
Test
Condition 1
Statement 1
TRUE
Test
Condition
3
FALSE
Statement 2
TRUETest
Condition 2
TRUE
Statement 2
FALSE
FALSE
Test
Condition
n
Statement n
Statement X
TRUE
FALSE
 The control statement which allows us to make decision from
the number of choices is called switch or switch case
statement.
 It is a multi way decision statement, it test the given variable
or expression against a list of case values.
switch (expression)
{
case constant 1:
block 1
break;
case constant 2:
block 2
break;
----------
----------
default:
default block
break;
}
Statement –x;
(Selection process of the SWITCH Statemen
Switch
expression
Block-1
Block-2
default
block
Statement-x
Expression = value -1
Expression = value -2
(no match) default
 This operator is a combination of ? And : , and takes
three operands.
 General form:
conditional expression ? exp-1:exp-2;
 This concept says that if this expression is true then
whatever we are writing after this question mark
statement, it will be executed.
And if this expression is false then whatever
we are writing after this colon statement, it will be
executed.
 Like many other languages, C supports the GOTO
statement to branch unconditionally from one point to
another in the program.
 Although it may not be essential to use the GOTO
statement in a Highly Structured Language.
 General form:
 Not recommended but may be used occasionally.
goto label;
……….
……….
……….
label:
statement;
 A WHILE loop has one control expression, and
executes as long as that expression is true.
 A WHILE loop is an entry controlled loop.
Syntax:
While (condition)
{
statement (s);
increment or decrement loop counter
}
Start
Initialize
Test
Condition
Stop
Body of Loop
Increment or Decrement
FALSE
TRUE
Flow chart of WHILE
 The body of the loop may not be executed if the condition is not
satisfied in while loop.
 Since the test is done at the end of the loop, the statement in the
braces will always be executed at least once.
 The statements in the braces are executed repeatedly as long as
the expression in the parentheses is true.
Make a note that do while loop ends in a ; (semicolon)
Note that Do…..While Looping Statement is Exit Controlled
Looping Statement.
Syntax:
initialize loop counter;
Do
{
statement (s);
increment or decrement loop counter
}
While (condition);
Start
Initialize
Test
Condition
Body of Loop
Increment or Decrement
FALSE
TRUE
Stop
Flow chart of
do-while
LOOP
 The for loop is another repetitive control structure, and is
used to execute set of instruction repeatedly until the
condition becomes false.
 To set up an initial condition and then modify some value to
perform each succeeding loop as long as some condition is
true.
 The three expressions:
expr1 – sets up the initial condition,
expr2 – tests whether another trip through the loop should
be taken,
expr3 – increments or updates thing after each trip.
Syntax:
for(expr1; expr2; expr3)
{
body of the loop;
}
Start
Body of Loop
Stop
Initialize; test condition; Increment / Decrement
Flow chart of for
Decision Making Statement in C ppt

More Related Content

PPTX
Unit 3. Input and Output
PPTX
Decision making statements in C programming
PPT
Data Structures and Algorithm Analysis
PPT
SEARCHING AND SORTING ALGORITHMS
PPTX
Industrial disputes Act,1947
PPTX
Register transfer language & its micro operations
PPTX
Asymptotic notations
PPTX
File in C language
Unit 3. Input and Output
Decision making statements in C programming
Data Structures and Algorithm Analysis
SEARCHING AND SORTING ALGORITHMS
Industrial disputes Act,1947
Register transfer language & its micro operations
Asymptotic notations
File in C language

What's hot (20)

PPT
Decision making and branching
PPT
RECURSION IN C
PPTX
Storage class in C Language
PPTX
Type casting in c programming
PPTX
Functions in C
PPT
File handling in c
PPTX
Data types in C
PPT
Decision making and looping
PPTX
Typedef
PPT
Structure of a C program
PPTX
Methods in java
PPTX
PPTX
Operators in java
PPSX
Type conversion
PPTX
Structure in C
PPTX
Function in C program
PPTX
Pointer in c
PPTX
Control Statements in Java
PPTX
Pointers in C Programming
Decision making and branching
RECURSION IN C
Storage class in C Language
Type casting in c programming
Functions in C
File handling in c
Data types in C
Decision making and looping
Typedef
Structure of a C program
Methods in java
Operators in java
Type conversion
Structure in C
Function in C program
Pointer in c
Control Statements in Java
Pointers in C Programming
Ad

Similar to Decision Making Statement in C ppt (20)

PPT
control-statements, control-statements, control statement
PPT
2. Control structures with for while and do while.ppt
PPT
control-statements detailed presentation
PPTX
CONTROL STMTS.pptx
PPT
control-statements....ppt - definition
PPT
_Java__Expressions__and__FlowControl.ppt
PPT
_Java__Expressions__and__FlowControl.ppt
DOCX
Chapter 4(1)
PPT
Control statements
PPTX
Diploma ii cfpc u-3 handling input output and control statements
PPTX
Mca i pic u-3 handling input output and control statements
PPTX
Btech i pic u-3 handling input output and control statements
PPTX
handling input output and control statements
PPTX
Bsc cs pic u-3 handling input output and control statements
PPTX
Programming Fundamentals in C++ structures
PPTX
Control statements in java
PPTX
C Programming - Decision making, Looping
PPTX
Flow of control C ++ By TANUJ
PPTX
Comp ppt (1)
PDF
PROBLEM SOLVING USING NOW PPSC- UNIT -2.pdf
control-statements, control-statements, control statement
2. Control structures with for while and do while.ppt
control-statements detailed presentation
CONTROL STMTS.pptx
control-statements....ppt - definition
_Java__Expressions__and__FlowControl.ppt
_Java__Expressions__and__FlowControl.ppt
Chapter 4(1)
Control statements
Diploma ii cfpc u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statements
Btech i pic u-3 handling input output and control statements
handling input output and control statements
Bsc cs pic u-3 handling input output and control statements
Programming Fundamentals in C++ structures
Control statements in java
C Programming - Decision making, Looping
Flow of control C ++ By TANUJ
Comp ppt (1)
PROBLEM SOLVING USING NOW PPSC- UNIT -2.pdf
Ad

Recently uploaded (20)

PDF
composite construction of structures.pdf
PPTX
Sustainable Sites - Green Building Construction
PDF
Well-logging-methods_new................
PDF
Digital Logic Computer Design lecture notes
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
additive manufacturing of ss316l using mig welding
PPTX
web development for engineering and engineering
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Geodesy 1.pptx...............................................
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
composite construction of structures.pdf
Sustainable Sites - Green Building Construction
Well-logging-methods_new................
Digital Logic Computer Design lecture notes
Foundation to blockchain - A guide to Blockchain Tech
additive manufacturing of ss316l using mig welding
web development for engineering and engineering
UNIT-1 - COAL BASED THERMAL POWER PLANTS
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
UNIT 4 Total Quality Management .pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
CH1 Production IntroductoryConcepts.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Geodesy 1.pptx...............................................
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf

Decision Making Statement in C ppt

  • 2.  Repeating important sections of the program.  Selecting between optional section of a program Decision Making Statement Decision Making and Branching IF Statement SWITCH Statement Conditional Operator Statement GOTO Statement Decision Making and Looping The WHILE Loop The do-while Loop The FOR Loop
  • 3. • DECISION MAKING AND BRANCHING  In programming the order of execution of instructions may have to be changed depending on certain conditions.  This involves a kind of decision making to see whether a particular condition has occurred or not and then direct the computer to execute certain instructions accordingly. • DECISION MAKING AND LOOPING  Execution of the statement or set of statement repeatedly is known as LOOPING.  This may be executed a specified number of times and this depends on the satisfaction of a test condition.  A program loop is made up of two parts one part is known as body of the loop and the other is known as control condition.  Depending on the control condition statement , the statements within the loop may be executed.
  • 4.  The IF statement is the powerful decision making statement and is used to control the flow of execution of the statements.  When decision making in a program they are simply the result of computation in which the final result is either TRUE or FALSE.  The value zero (0) is considered to be FALSE in program. Any positive or negative value is considered to be TRUE. Levels of complexity for IF: 1.Simple IF statement 2.IF…..ELSE statement 3.NESTED IF…..ELSE statement 4.ELSE…..IF ladder
  • 5. It is used to control the flow of execution of the statements and also to test logically whether the condition is true or false. Syntax: if (condition) { statement ; }
  • 6. If the condition is true then the statement following the “if” is executed if it is false then the statement is skipped. ( Flow chart of Simple if statement ) Test Condition Executable X - Statement TRUE
  • 7. The if…..else statement is an extension of the simple if statement. Syntax: if (condition) { statement 1; (if the condition is TRUE this statement will be executed) } else { statement 2; (if the condition is FALSE this statement will be executed) }
  • 8. It is used to execute some statements when the condition is true and execute some other statements when the condition is false depending on the logical test. ( Flow chart of if…..else statement ) Test Condition Executable X - StatementExecutable Y - Statement TRUEFALSE
  • 9.  When a series of if…..else statements are occurred in a program, we can write an entire if…..else statement in another if…..else statement called NESTING. Syntax: If (condition 1) { if (condition 2) { statement 1; } else { statement 2; } } else { if (condition 3) statement 3; else statement 4; }
  • 10. Test Condition-1 Test Condition-1 Statement-2 Statement-3 Statement-3 Statement-4 ( Flow chart of nested if……else statement ) TRUE TRUE FALSE FALSE Test Condition-3 FALSE TRUE
  • 11. When a series of decisions are involved we have to use more than one if…..else statement called as multiple if’s. Multiple if…..else statements are much faster than a series of if…..else statements, since their structure when any of the condition is satisfied. Syntax: if (condition 1) statement 1; else if (condition 2) statement 2; else if (condition 3) statement 3; ---------------- ---------------- else if (condition n) statement n; else statement x;
  • 12. ( Flow chart of else…..if ladder ) Test Condition 1 Statement 1 TRUE Test Condition 3 FALSE Statement 2 TRUETest Condition 2 TRUE Statement 2 FALSE FALSE Test Condition n Statement n Statement X TRUE FALSE
  • 13.  The control statement which allows us to make decision from the number of choices is called switch or switch case statement.  It is a multi way decision statement, it test the given variable or expression against a list of case values. switch (expression) { case constant 1: block 1 break; case constant 2: block 2 break; ---------- ---------- default: default block break; } Statement –x;
  • 14. (Selection process of the SWITCH Statemen Switch expression Block-1 Block-2 default block Statement-x Expression = value -1 Expression = value -2 (no match) default
  • 15.  This operator is a combination of ? And : , and takes three operands.  General form: conditional expression ? exp-1:exp-2;  This concept says that if this expression is true then whatever we are writing after this question mark statement, it will be executed. And if this expression is false then whatever we are writing after this colon statement, it will be executed.
  • 16.  Like many other languages, C supports the GOTO statement to branch unconditionally from one point to another in the program.  Although it may not be essential to use the GOTO statement in a Highly Structured Language.  General form:  Not recommended but may be used occasionally. goto label; ………. ………. ………. label: statement;
  • 17.  A WHILE loop has one control expression, and executes as long as that expression is true.  A WHILE loop is an entry controlled loop. Syntax: While (condition) { statement (s); increment or decrement loop counter }
  • 18. Start Initialize Test Condition Stop Body of Loop Increment or Decrement FALSE TRUE Flow chart of WHILE
  • 19.  The body of the loop may not be executed if the condition is not satisfied in while loop.  Since the test is done at the end of the loop, the statement in the braces will always be executed at least once.  The statements in the braces are executed repeatedly as long as the expression in the parentheses is true. Make a note that do while loop ends in a ; (semicolon) Note that Do…..While Looping Statement is Exit Controlled Looping Statement. Syntax: initialize loop counter; Do { statement (s); increment or decrement loop counter } While (condition);
  • 20. Start Initialize Test Condition Body of Loop Increment or Decrement FALSE TRUE Stop Flow chart of do-while LOOP
  • 21.  The for loop is another repetitive control structure, and is used to execute set of instruction repeatedly until the condition becomes false.  To set up an initial condition and then modify some value to perform each succeeding loop as long as some condition is true.  The three expressions: expr1 – sets up the initial condition, expr2 – tests whether another trip through the loop should be taken, expr3 – increments or updates thing after each trip. Syntax: for(expr1; expr2; expr3) { body of the loop; }
  • 22. Start Body of Loop Stop Initialize; test condition; Increment / Decrement Flow chart of for