What Is S?

June 27, 2017

We have something different today. Given this code:

int s = 0;

for (int i=0; i<x; i++)
    for (int j=i+1; j<y; j++)
        for (int k=j+1; k<z; k++)
            s++;

What is s? What is a closed-form formula for computing s?

Your task is to compute s. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2