Well … you have now reached a stage where you can learn about the power of computers. Sometimes during Programming we encounter, when we want certain block or segment to be repeated several times. We are too lazy to write the segments so many times, therefore we use loop controls.
Loops are used to repeat a block of code. Being able to have your Program repeatedly execute a block of code is one of the most basic but useful tasks in Programming -- many program or website that produces extremely complex outputs are really only executing a single task many times. Now, think about what this means: a loop lets you write a very simple statement to produce a Significantly greater result simply by repetition.
In C there are three methods of implementing loops:
- For Loop
- While Loop
- Do-While Loop
- nested Loop
For Loop Exampleint main()
for (i = 0; i < 10; i++)