Home » Classroom » SS3 ICT Basic Programming IV Question

How would you modify the BASIC code provided to... - SS3 ICT Basic Programming IV Question

How would you modify the BASIC code provided to calculate the sum of the first 100 integers if you wanted to calculate the sum of the first 200 integers instead?

To calculate the sum of the first 200 integers in BASIC, you would modify the loop to iterate from 1 to 200 instead of 1 to 100. Here is the modification:

BASIC Copy code

total = 0

FOR i = 1 TO 200

    total = total + i

NEXT i

PRINT "Sum of first 200 integers is: "; total

Please share this, thanks:

Add your answer

Notice: Posting irresponsibily can get your account banned!

No responses