Saturday, 4 February 2017

Loops in programming languages.

Tags

Loops are used to repeat set of codes or a single code. There are three types of loops explained in below;

1)for loop

    This loop is very commonly used and syntax is very easy.

    syntax;

    for(var initialization; var condition; increament of variable)
    for example;

    for(i=0;i<=10;i++)
    {

      cout<<"";
      or
       printf("");

     }

2)while loop
  
   while loop is very simple and syntax is ;
    while(condition)
{
}
   
    while(x<=10)
     {
}

3)do-while loop
syntax;

do{
printf();
}
while();