Loops

Loop is a sequence of instructions that is repeated the same process in a multiple times until the specific condition satisfies.
In C language there are three types of loops are used.It is enables us to alter the flow of program they instead of writing the same code again and again. and we can repeat the same code for finite numbers of time.
In the loop they can provide code reusability. We can using a loop then they cannot write a code again and again.

There are three types of loops in C language

  • do while loop
  • while loop
  • for loop
  • do while loop: In do-while loop continues until a given condition satisfies.They are control flow statement that executes a block code at least once and then either repeatedly executes the block.

    Syntax of the do-while loop

    do{
    //code to be executed
    }while(condition);
  • while loop: In while loop has one control condition and they can execute as long they can condition is true.In the condition of the loop is tested before the body of the loop is executed.

    Syntax of the while loop

    While (condition)
    {
    statement(s);
    Incrementation;
    }
  • for loop: A for loop is a repetition control structure that allow you to efficiently write a loop that need to executes a specific number of times. The for-loop is also called a pre-tested loop.

    Syntax of the for loop

    for(initialization;condition;incr/decr)
    {
    //code to be executed
    }

Submit your review
1
2
3
4
5
Submit
     
Cancel

Create your own review

The Technical Funda
Average rating:  
 0 reviews