LOOPING
Table Of Content
Types of
loop
Looping
definition
For loop
While
loop
Do while
loop
In computer programming, a loop is a sequence of
instructions that is continually repeated until a
certain condition is reached
Programming language provide various control
structures that allow for more complicated
execution paths
Loop control statement change execution from its
normal sequence. When execution leaves a scope,
all automatic objects that were created in that
scope are destroyed.
A Loop statement allows us to execute a
statement or group of statements multiple times .
Loop type Description
While loop Repeats a statement or group of
statements while a given condition is
true. It tests the condition before
executing the loop body.
For loop Execute a sequence of statements
multiple times and abbreviates the
code that manages the loop variable.
Do-while loop Like a while statement, except that it
tests the condition at the end of the
loop body
Nested loop You can use one or more loop inside any
another while, for or do while loop
The syntax of a for loop in C programming language is :
In computer science a for loop is a programming language
statement which allows code to be repeatedly executed
SYNTAX
The syntax of a while loop in C programming language :
Here, statement(s) may be a single statement or a
block of statements. The condition may be any
expression, and true is any nonzero value. The loop
iterates while the condition is true.
When the condition becomes false, the program
control passes to the line immediately following the
loop.
A while loop statement in C programming language
repeatedly executes a target statement as long as a
given condition is true.
Unlike for and while loops, which test the loop condition at the top of the loop, the do...while loop
in C programming checks its condition at the bottom of the loop.
A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least
one time.
The syntax of a do...while loop in C programming language is −
C programming allows to use one loop inside another loop. The following section shows
a few examples to illustrate the concept.
Loops
Loops
Loops

Loops

  • 1.
  • 2.
    Table Of Content Typesof loop Looping definition For loop While loop Do while loop
  • 3.
    In computer programming,a loop is a sequence of instructions that is continually repeated until a certain condition is reached Programming language provide various control structures that allow for more complicated execution paths Loop control statement change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. A Loop statement allows us to execute a statement or group of statements multiple times .
  • 4.
    Loop type Description Whileloop Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. For loop Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable. Do-while loop Like a while statement, except that it tests the condition at the end of the loop body Nested loop You can use one or more loop inside any another while, for or do while loop
  • 5.
    The syntax ofa for loop in C programming language is : In computer science a for loop is a programming language statement which allows code to be repeatedly executed
  • 8.
    SYNTAX The syntax ofa while loop in C programming language : Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any nonzero value. The loop iterates while the condition is true. When the condition becomes false, the program control passes to the line immediately following the loop. A while loop statement in C programming language repeatedly executes a target statement as long as a given condition is true.
  • 11.
    Unlike for andwhile loops, which test the loop condition at the top of the loop, the do...while loop in C programming checks its condition at the bottom of the loop. A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one time. The syntax of a do...while loop in C programming language is −
  • 14.
    C programming allowsto use one loop inside another loop. The following section shows a few examples to illustrate the concept.

Editor's Notes

  • #3 © Copyright PresentationGO.com – The free PowerPoint and Google Slides template library