EduPadi logo
Home Pricing Free Resources
Blog
For Schools Get started

Pass IELTS, JAMB, WAEC, & more with EduPadi CBT App

Practice questions, get instant scores, understand solutions with smart AI insights, and track your progress.

Explore EduPadi App…

Write a BASIC program that calculates the sum o...

Write a BASIC program that calculates the sum of all even numbers from 1 to 50 using a loop

Here is a BASIC program that calculates the sum of even numbers from 1 to 50 using a FOR-NEXT loop:

basic Copy code

total = 0

FOR i = 2 TO 50 STEP 2

    total = total + i

NEXT i

PRINT "Sum of even numbers from 1 to 50: "; total

This program initializes a total variable to 0 and then uses a FOR-NEXT loop with a step of 2 to iterate through even numbers from 2 to 50, adding them to the total variable. Finally, it prints the sum.