This document discusses iterative control in C programming through loops. It defines looping as repeatedly executing a sequence of statements until a termination condition is met. There are three main types of loops in C - while loops, do-while loops, and for loops. Loops can be classified as entry-controlled (like while and for loops), where the termination condition is checked before the loop body executes, or exit-controlled (like do-while loops), where the body executes unconditionally first before the condition is checked. Some example uses of while loops are provided.
This document discusses iterative control in C programming through loops. It defines looping as repeatedly executing a sequence of statements until a termination condition is met. There are three main types of loops in C - while loops, do-while loops, and for loops. Loops can be classified as entry-controlled (like while and for loops), where the termination condition is checked before the loop body executes, or exit-controlled (like do-while loops), where the body executes unconditionally first before the condition is checked. Some example uses of while loops are provided.
This document discusses iterative control in C programming through loops. It defines looping as repeatedly executing a sequence of statements until a termination condition is met. There are three main types of loops in C - while loops, do-while loops, and for loops. Loops can be classified as entry-controlled (like while and for loops), where the termination condition is checked before the loop body executes, or exit-controlled (like do-while loops), where the body executes unconditionally first before the condition is checked. Some example uses of while loops are provided.
Syed Shahrooz Shamim Junior Lecturer, CS Department, UIT ITERATIVE CONTROL Iterative Statements Looping • In looping, a sequence of statements are executed until some condition is satisfied which is placed for termination of the loop • A program loop consists of two segments • body of the loop • the control statement • The control is tested always for execution of the body of the loop Iterative Statements How loop works Iterative Statements • Loops may classified as: • entry-controlled loop • exit-controlled loop Entry Controlled Loop • The control conditions are tested before the start of the loop execution. • If the conditions are not satisfied , then the body of the loop will not be executed. • Entry controlled loop is also known as pre-test loop. • Example: – While Loop for Loop Exit Controlled Loop • The Test is performed at the end of the body of the loop and there fore the body is executed unconditionally for the first time. • Exit controlled loop is also known as post-test loop. • Ex- ->Do-While Types of loop There Are three types of loops in C: • While loop • Do-while loop • For loop While Loop While Loop Example 1. Program to print first 10 numbers 2. Program to add first 10 numbers 3. Program to add first 10 even numbers 4. Program to add first 10 odd numbers