Since your Print S is outside the For-Next loop
it gets printed only once, at the end
And since S will be set to 6 before reaching the
4 next C, where the program would check
Complete a trace chart:
S C
0 1
1 2
3 3
6 4
10 5
15
So your output is 15,
Why don't you just run these little programs and see what comes out
write the output of the segment of the program below
1 let S=0
2 For C = 1 to 5
3 let S = S+C
4 next C
5 Print S
3 answers
my system got damage......
pls how to solve this question
write the output of the segment of program below
10 READ score
20 DATA 60
30 IF score <=49 THEN
40 PRINT "you have failed"
50 ELSELF score >=50 AND score <=59 THEN
60 PRINT "you have B"
70 ELSELF score >=60 AND score <=69 THEN
80 PRINT "YOU have B"
90 ELSE
100 PRINT "YOU have A"
110 END
write the output of the segment of program below
10 READ score
20 DATA 60
30 IF score <=49 THEN
40 PRINT "you have failed"
50 ELSELF score >=50 AND score <=59 THEN
60 PRINT "you have B"
70 ELSELF score >=60 AND score <=69 THEN
80 PRINT "YOU have B"
90 ELSE
100 PRINT "YOU have A"
110 END