Page 108 - TechPluse_C7_Flipbook
P. 108
Program 2: To check whether the input number given by the user is greater or smaller than 100.
Program 3: To check if a number is divisible by 5.
Program 4: To check if a number is even or odd.
LOOPING
To print the numbers from 10 to 1 you can create a program in two ways. You can either give
separate instructions to print each output or give a single set of instructions to print the output.
This set of instructions will repeat for a fixed number of times or until a condition is satisfied. This
is called looping. In BASIC-256, the statements used for repetition of instructions in a program
are called iterative statements or looping statements. Looping statements are very useful
and necessary for developing an application. BASIC-256 provides FOR...NEXT and WHILE...END
WHILE as looping statements. Let's learn about them.
FOR…NEXT Statement
The FOR...NEXT statement is used to run a code a fixed number of times. To manage this kind of
loop, you create a variable that tracks how many times the loop will run. Generally, this variable
is called a count control variable. The basic syntax of the FOR...NEXT statement is as follows:
106 Premium Edition-VII

