Wednesday, 18 November 2015

Iteration


iteration means repetition .iteration statenentys are the statemnents repedately execute one or more than one statement .these iterations are also called loops .
these loops are to execute a set of instructions until condition becomes false these loops are having following part. 
  • Initialization:-  It defines loop variable 
  • conditional expression (>,<,<=,>=,==,>>,<< etc ):- it is  a relational expression with or without logical operators 
  • update expression (increment and decrement opreators ):- this expression changes the value of loop variable it is executed at the end of each iteration
  • the body of loop  

there are three kinds of loop :
  • For loop :-    it executes the statements or sets of statements repeadetly until the conditional expression becomes false . the genral syntax for FOR loop :
                               
  • While : it is also called entry -controller loop this loop is written as   :                           


  • Do-while  :



















click here for programs for c&c++:

No comments:

Post a Comment