Skip to main content

Difference between For Loop & While Loop

 

 For Loop

 While Loop

 In for loop  Initialization condition test and increment/ decrement likes same line.

In while first Initialization then condition and last increment/decrement in different line.

 It syntax easy  for write code.

It syntax complex to write code. 

 Syntax:
          for(i=0; i<10; i++)
        { printf("%d\t", i);}    
 Syntax:
          i=0;
        while(i<0)
        { printf("%d\t", i);
                i = i+1;}

Comments

Popular posts from this blog

BCA mathematics -I (Unit I Set)

 .

BCA Mathematics -I (Unit I Complex Number)

 .

BCA Mathematics -I (Unit I Natural Number)

.