Saturday, August 14, 2010

HOW TO USE 'FOR'LOOP

 SYNTAX:

       for counter=legal list of values

          statement to be executed repeatedly with in this loop

      end

Example:

    >> sum=0;
    >> for i=1:10
         sum=sum+i;
    end
    >> sum

    sum =

        55

No comments:

Post a Comment