Q 7: What is the number of `Hello's printed by the pseudo code below? (for i from lo to hi

exhaust i between lo and hi inclusive, and is a empty loop when lo is greater than hi)
(b) for i from 1 to 10
for j from i to 10
for k from i to j
print `Hello'

Try some samples to see:

i = 1, j = 1: k from 1 to 1 --> 1 Hello
i = 1, j = 2: k from 1 to 2 --> 2 Hellos
i = 1, j = 3: k from 1 to 3 --> 3 Hellos
.
.
.
i = 1, j = 10: k from 1 to 10 --> 10 Hellos
So for i = 1, sum the numbers from 1 to 10 (triangular formula): (10)(10 + 1)/2 = 55 Hellos

Now try for i = 2:
i = 2, j = 1: k from 2 to 1 --> lo greater than hi, so no Hellos
i = 2, j = 2: k from 2 to 2 --> 1 Hello
i = 2, j = 3: k from 2 to 3 --> 2 Hellos
.
.
.
i = 2, j = 10: k from 2 to 10 --> 9 Hellos
So for i = 2, sum the numbers from 1 to 9 (triangular formula again): (9)(9 + 1)/2 = 45 Hellos

Now try for i = 3:
(Can you see the pattern emerging, by looking at the results of i = 1 and i = 2? This time, you should end up summing the numbers 1 to 8 for the number of Hellos.)

Etc.
At the end, sum up your sums to get the total number of Hellos.

To determine the number of `'Hello's` printed by the given pseudo code, we need to analyze the nested loops and their iterations.

The first loop `(for i from lo to hi)` is not specified, so we cannot determine the number of iterations or even the range of `i`.

The second loop `(for i from 1 to 10)` runs from `i = 1` to `i = 10`, iterating a total of `10` times.

Inside the second loop, there is a third loop `(for j from i to 10)`, which runs from `j = i` to `j = 10`. The value of `i` changes on each iteration of the second loop, so the number of iterations of this third loop varies.

Finally, within the third loop, there is a fourth loop `(for k from i to j)`. This loop runs from `k = i` to `k = j`. Like the third loop, the number of iterations of this fourth loop varies depending on the values of `i` and `j`.

Inside the fourth loop, there is a print statement that prints `'Hello'`.

To calculate the exact number of `'Hello's` printed, we need to consider the iterations of each loop in sequence. Unfortunately, since the range or values of `i` are not specified in the given pseudo code, we cannot determine the exact number of `'Hello's` printed.

To determine the number of `Hello's printed by the given pseudo code, we need to analyze the nested loops and their iterations.

The first loop `for i from 1 to 10` will iterate 10 times, starting from 1 and increasing by 1 with each iteration.

The second loop `for j from i to 10` will iterate for each value of `i` from the previous loop. For the first iteration, `i` will be 1, so this loop will iterate 10 times. For the second iteration, `i` will be 2, so this loop will iterate 9 times. This pattern continues until `i` reaches 10, where this loop will iterate only once.

The third loop `for k from i to j` will iterate for each value of `i` and `j` from the previous loops. For each combination of `i` and `j`, this loop will iterate `j - i + 1` times.

Within the innermost loop, the statement `print `Hello'` will execute and print "Hello" each time it is reached.

To find the total number of `Hello's printed, we need to sum up the number of iterations of the innermost loop from all possible combinations of `i` and `j`.

Let's calculate it step by step:

For `i = 1`:
- For `j = i = 1`, the innermost loop will iterate once.
- For `j = i + 1 = 2`, the innermost loop will iterate twice.
- For `j = i + 2 = 3`, the innermost loop will iterate three times.
- ...
- For `j = 10`, the innermost loop will iterate ten times.

So, for each value of `i` from 1 to 10, the number of `Hello's` printed in the innermost loop will be:
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55

Therefore, the total number of `Hello's` printed by the given pseudo code is 55.