40 POINTS!!! PLEASE ANSWER SOON. WILL MARK BRAINLIEST
Consider the following algorithm:

Step 1: Input a positive integer N.

Step 2: Begin with sum equal to 0 and n equal to 1.

Step 3: Find the n'th odd number, which is 2n-1, and increase sum by this odd number.

Step 4: Increase n by 1.

Step 5: If n > N, then stop and output sum. Otherwise, go back to step 3.

What number does this algorithm output if we input N = 6?

Respuesta :

Answer:

36

Step-by-step explanation:

N = 6

S = 0 n = 1

2(1) - 1 = 1

S = 0 + 1 = 1

n = n + 1

n = 1 + 1

n = 2

S = 1 n = 2

2(2) - 1 = 3

S = 1 + 3 = 4

n = n + 1

n = 2 + 1

n = 3

S = 4 n = 3

2(3) - 1 = 5

S = 4 + 5 = 9

n = n + 1

n = 3 + 1

n = 4

S = 9 n = 4

2(4) - 1 = 7

S = 9 + 7 = 16

n = n + 1

n = 4 + 1

n = 5

S = 16 n = 5

2(5) - 1 = 9

S = 16 + 9 = 25

n = n + 1

n = 5 + 1

n = 6

S = 25 n = 6

2(6) - 1 = 11

S = 25 + 11 = 36

n = n + 1

n = 6 + 1

n = 7 > N

Stop