Introduction of loops in c language


                          Friends in c there are different types of loop statements like for loop, while loop, do-while loop, etc. and in this blog, I will explain the for loop, while loop and do-while loop.
●for loop:
                          for loop is entry controlled loop. When loop value returns true then the body of the loop executed till the value returns true, if loop value returns false controlled transfer to end of the program and the body will not be executed.

Syntax.
for(initialization; condition; incrementation)
{ body of the loop
}

●while loop:
                      This is the entry control loop or talk tested looping statement. This loop test the condition first if the condition returns true then the body of the loop is executed till the loop value returns true if the condition value returns false then the control is transfer to the out of the loop and body of the loop does not execute.

Syntax.
while (test the condition)
{
Body of the loop;
}

●do-while loop:
                     This is called as exit control or button tested looping statement. In this loop, the body of the loop executed first the condition will be check. If the condition returns true then the body of the loop executed continuously till the condition value returns true if condition value returns false then also the body of the loop is executed ones.

Syntax.
do
{
Body of the loop;
}
while (test the condition)

FRIENDS OUR LIFE IS LIKE A LOOP BECAUSE IN OUR LIFE MANY TURNS come AND ACCORDING TO THAT TURNS WE ARE MAKE A DECISIONS





Introduction of loops in c language Introduction of loops in c language Reviewed by Amit Waghmare on September 22, 2018 Rating: 5

No comments: