Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
C: Loops for data triples using for


1. C: Loops for data triples using for
If this page does not make sense to you after studying it and trying the code, then go back and study and try the code in the following.
There are times when adjacent triples of data need to be considered or processed together.

The code below shows how to read in a series of integers and then add adjacent triples together.

In addition, the first value read is saved for processing later.

A header loop is used.

2. Triples
Consider the following sequence of integers. Here is a sequence of lines highlighting each of the triples. Here is the C code.


3. Examples of input and output
Here are some examples of input and output for the above program code.

Here is an example input.

For the above example input, here is the expected output.

Here is an example input.

For the above example input, here is the expected output.


4. End of page