6. WHAT US DECISION MAKING?
Decision making structures require that the
programmer specifies one or more
conditions to be evaluated or tested by the
program, along with a statement or
statements to be executed if the condition is
determined to be true, and optionally, other
statements to be executed if the condition is
determined to be false.
The diagram in the right is the general form
of a typical decision making structure found
in most of the programming languages.
9. ● Relational Statements are the statements that compares the
values of two arithmetic expressions and produces a result of
either True or False.
● General syntax left_operand relational_operator
right_operand
● Operand can be variables, or any arithmetic expression.
● Example:
i < 5,
i + j > 3 * k
WHAT IS RELATIONAL STATEMENT?
12. WHAT IS IF, IF/ELSE STATEMENT?
An if statement is a programming conditional statement that, if proved true,
performs a function or displays information.
Below is a general example of an if statement, not specific to any
particular programming language.
In the example above, if the value of X were equal to any number less than
10, the program displays, "Hello John" when the script is run.
15. WHAT IS SIMPLE IF STATEMENT?
A Simple if statement consists of a Boolean
expression followed by one or more statements.
16. EXECUTION OF SIMPLE IF STATEMENT
if(expression)
{
statement inside;
}
statement outside;
The general form of a simple if statement is,
If the expression returns true,
then the statement-inside will be executed,
otherwise statement-inside is skipped and only
the statement-outside is executed.
19. DEFINITION
An if statement can be followed by an
optional else statement, which executes when
the Boolean expression is false.
20. EXECUTION OF SIMPLE IF STATEMENT
If the expression is true, the statement-block1 is
executed, else statement-block1 is skipped
and statement-block2 is executed.
The general form of a simple if...else statement is,
23. WHAT IS NESTED IF… ELSE STATEMENT?
When one if or else if statement is used inside
another if or else if statement(s) then it is called
nested if...else statement
24. EXECUTION OF NESTED IF…ELSE STATEMENT
The general form of a nested if...else statement is,
if expression is false then statement-block3 will be executed,
otherwise the execution continues and enters inside the
first if to perform the check for the next if block, where
if expression 1 is true the statement-block1 is executed
otherwise statement-block2 is executed.
27. WHAT IS ELSE IF LADDER?
Else If ladder occurs like If any true statement is
found, the statement associate with it is
executed
28. EXECUTION OF ELSE IF LADDER STATEMENT
The general form of else-if ladder is,
The expression is tested from the top(of the ladder)
downwards. As soon as a true condition is found,
the statement associated with it is executed.
31. WHAT IS LOOPING STATEMENT?
You may encounter situations, when a block of code
needs to be executed several number of times. In
general, statements are executed sequentially: The
first statement in a function is executed first,
followed by the second, and so on.
Programming languages provide various control
structures that allow for more complicated execution
paths.
A loop statement allows us to execute a statement or
group of statements multiple times.
The Given right diagram is the general form of a loop
statement in most of the programming languages.
32. DEFITION & TYPES
It is more like a while
statement, except that it
tests the condition at
the end of the loop
body.
For Loop
Executes a sequence of
statements multiple times and
abbreviates the code that
manages the loop variable.
Repeats a statement or group of
statements while a given
condition is true. It tests the
condition before executing the
loop body.
While Loop Do While Loop
33. DEFITION & TYPES
When one or more
loops inside any other
while, for, or do..while
loop is used
Nested Loop