What are the 3 parts of a for loop?

 for loop in C or C++.

In programming language a loop is used for repetition of a block of code. the syntax for a for loop is:-

Syntax:-

for( initialization ; condition ; increment\Decrement)

{

// statements inside the body of the loop.

}

  1. for(i=0;i<=10;i++) 
  2. { 
  3. // body of the for loop 
  4. } 

in the above syntax-

  • the initialization statement is executed only once.
  • then the condition expression is evaluated. if the condition expression is true, the the body of the statement of for loop will be executed. this process executed continuously whenever the condition expression is not false. if the condition expression is false the for loop is automatically terminated.
  • And the last one is increment or decrement. the increment operator is increase the value of the initialization with 1 and decrease operator decrease the value of the initialization with 1. hope this will helped you.

If you want learn more about programming language then you can visit my blog website.

Comments

Popular posts from this blog

proassignment help backlink data index 41

programming shark backink data index 31

Programming shark backlink data index 67