BASIC Program to Find Even Numbers Using FOR TO NEXT statement

Looking for some examples of BASIC programming language? Then here's a BASIC Program to find even numbers using the FOR TO NEXT statement.

There are several BASIC programming language statements and commands that can be employed in arithmetic computations and much more.

The program below tries to find the even numbers between 0 and 50 and then prints the result out to the screen.

Here's what it looks like:

Program Code

Sum = 0
FOR even = 2 T0 50 STEP 2
Sum = Sum + Even
NEXT even
PRINT "The even numbers are:"; Sum

How The Program Works

We begin by clearing the screen with the CLS statement and then proceed to initialize our variable Sum to 0.

At 0, we ensure that there is no value currently in SUM that may give us an unexpected result.

Next, we set a looping condition using the FOR TO NEXT statement in BASIC.

Here, the variable Even is initialized to 2 and stopped at 50, hence that is the range between which our even numbers will be selected.

On the other hand, you can choose to print the even numbers to the screen instead of adding them together and assigning it to sum. Thus that section of the program will append to become.

For even = 2 TO 50 STEP 2
Next even
Print "The even numbers are :"; Even

Whichever is the case, you'll get a set of even numbers displayed to the screen and the total sum of the numbers generated.


This simple BASIC Program to Find Even Numbers Using FOR TO NEXT statement can help you write more program codes in future and even program in complex programming languages. Now take the next step and give it some practice.

Also Read: BASIC Program to Compare The Greatest of Three Numbers
                   Pascal Program of Matrix Multiplication
                   BASIC Program to Create Multiplication Table


Tech blogger, SEO expert, cryptocurrency enthusiast, and freelancer are the terms that describe me. I'll rather write a thousand words than speak hundred words, and that describes my passion as a content creator.