Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • C Loops Syntax

    • 0
    • 2
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 84
    Comment on it

    C provides following types of loops:

    1. for loop.
    2. while loop.
    3. do-while loop.
    4. nested loop.

    For Loop :

    Syntax:

     for( initialization; condition; increment/decrement) {
                   // Statement1
                  //Statement2
               }
    

    where, initialization of variable, condition is till where you want to execute the statements increment/ decrement of counter.

    while Loop:

    Syntax:

     while(condition) {
                    //Statement1
                   // Statement2
               }
    where, condition is that till where when you want to execute your statements.
    

    do-while Loop:

    Syntax:

    do{
                   //Statement1
                  //Statement2
                 }while(condition);
    
     where, condition is till where you want to execute the statements.
    

    Nested Loop:

    Syntax:

     for( initialization; condition1; increment/decrement) {
                    // Statements
                       for( initialization; condition2; increment/decrement) {
                               //Statement1
                               //Statement2
                      }
                  }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: