Loops

This lesson will teach you about the general concept of loops and will also cover three types of loops: the for loop, the while loop, and the do-while loop.

We'll cover the following

One of the most useful properties of programmable computers is that you can ask them to repeat a calculation or operation many many times, and they will not (usually) complain. The looping constructs in C allow us to repeatedly execute a block of code many times, without having to manually re-type or re-list the code by hand.

As a simple example, let’s say we want to compute the cumulative sum of integers between 1 and 100. We could write code like the following:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy