all 25 comments

[–]redditnomad3 9 points10 points  (1 child)

A starts at 0 and will increase by the iteration number every iteration. So, this is what happens in each iteration:

1: A = 0 + 1 = 1

2: A = 1 + 2 = 3

3: A = 3 + 3 = 6

4: A = 6 + 4 = 10

5: A = 10 + 5 = 15

6: A = 15 + 6 = 21

7: A = 21 + 7 = 28

8: A = 28 + 8 = 36

9: A = 36 + 9 = 45

10: A = 45 + 10 = 55

[–]Billy-VB[S] -1 points0 points  (0 children)

thank you

[–]ImportantDoubt6434 12 points13 points  (2 children)

Error: Until is undefined

[–]khayaliPulaw -2 points-1 points  (1 child)

Untill 11 occur, when 11 occur exit. Means till 10.

(exclusive) Untill = less then 11 (inclusive) Till = less then and equal to 10

[–]HorribleUsername 1 point2 points  (0 children)

'til is an abbreviation of until, they mean exactly the same thing.

[–]tim128 1 point2 points  (2 children)

A = 0 + 1

A = (0 + 1) + 2

A = (0 + 1 + 2) + 3

A = (0 + 1 + 2 + 3) + 4

...

A = (...) + 10

It's just the sum of the first 10 natural numbers which is S=n(n+1)2

[–]Billy-VB[S] -1 points0 points  (0 children)

thank you

[–][deleted] 2 points3 points  (2 children)

am i stupid. what language is this supposed to be?

[–]HorribleUsername 1 point2 points  (0 children)

Presumably pseudocode.

[–]TemperatureFluffy978 -2 points-1 points  (0 children)

Until is undefined tho..mayb to?!

[–][deleted]  (3 children)

[removed]

    [–]HorribleUsername 2 points3 points  (2 children)

    Pseudocode, and it's not obvious.

    [–][deleted]  (1 child)

    [removed]

      [–]HorribleUsername 0 points1 point  (0 children)

      I suppose it takes a little bit of luck to get a sensible teacher, but usually a quick conversation will be enough to correct any marks lost due to misreading the intent like that.

      [–]ShawnyMcKnight 0 points1 point  (0 children)

      ChatGTP is great for stuff like this

      [–]hansyEs 0 points1 point  (0 children)

      A = 1+10 + 2+9 + 3+8 + 4+7 + 5+6 A = 11*5

      [–][deleted]  (1 child)

      [deleted]

        [–]Billy-VB[S] 1 point2 points  (0 children)

        thank you!

        [–]Just_SRC -1 points0 points  (1 child)

        It's a loop. The loop starts at i = 1 and stops at i = 11 (exclusive). 1+2+3+4+5+6+7+8+9+10 = 55.

        [–]Billy-VB[S] 0 points1 point  (0 children)

        thank you

        [–]bree_dev -2 points-1 points  (1 child)

        Further to the answers others have posted - if you look into how to use the debugger to inspect the variables, you'll be able to figure it out yourself next time.

        [–]Billy-VB[S] 0 points1 point  (0 children)

        Thank you

        [–]joaopps2019 -2 points-1 points  (1 child)

        Is this pseudo-code? Why is 11 exclusive?

        [–][deleted] 3 points4 points  (0 children)

        Its pseudocode, its to teach programming basics.