Wednesday, October 13, 2010

What is Loops in C and C Plus Plus Programmings

,
Introduction

Loops in simple languages it's process of round (circle) of a work or activity. C and C Plus Plus also provide this function in c  and c plus plus. It provide a function which repeat your code in a block. It itterate you code and execute until work when condition will not be false.

Types of Loops

1. While Loop
2. Do While Loop
3. For Loop

While Loop:- While Loop is another type of loop which very useful for C Programmings.  In this loop in case we are using increament or decrement with condition. then atleast one time increament or decrement will be run. Either it's true or false condition.

Examples of Do While loop

# Include
main()

{

int a,i;

a=1;
while (x=10);
{

printf(x++);

}

}


Do While:-Do While Loop is another type of loop which very useful for C Programmings.  In this loop in case we are using increament or decrement with condition. then 1st Condition check after then increment and decrements is possible.


# Include
main()

{

do
{
while (x=10);
}
{

printf(x++);

}

};


For Looop:-For Loop is another type of loop which very useful for C Programmings.  In this loop in case we are using increament or decrement with condition. then we can intialize the value, test the condition and increament or decrement at a time

# Include
main()

{

int a;
for (i=0;i<=5;i++)
{

printf("%d",i);
}

};

0 comments to “What is Loops in C and C Plus Plus Programmings”

Post a Comment