Finding R

Report a typo

Given an array of integers:

a = [0, 2, 7, 4, 2, 1]

The procedure below performs some calculations with the array:

r = 0
for (i = 0; i < len(a); i = i + 1):
    if a[i] < len(a) then:
        r = r + a[i]

Print the final value of rr after these calculations in the answer field below. The output should be an integer number.

Recall that len(a) returns the length of the array a.

Enter a number
___

Create a free account to access the full topic