determine the value of the variable S after executing the fragment of the algorithm: s:=0 nc for i from 1 to 5 s:=s+i*i kts

Paul Reilly

Paul Reilly

Answered question

2022-09-14

determine the value of the variable S after executing the fragment of the algorithm:
s:=0
nc for i from 1 to 5
s:=s+i*i
kts

Answer & Explanation

Blaine Day

Blaine Day

Beginner2022-09-15Added 14 answers

The correct answer is 55.
s=0 start loop execution: i=1 s=0+1*1=1
i=2 s=1+2*2=1+4=5; i=3 s=5+3*3=5+9=14; i=4 s=14+4*4=14+16=30; i=5
s=30+5*5=30+25=55

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?