Hila Research Centre
Computer Programming - 5
Homework Help:
Your computer can help you with your homework! Here's a program to help you add
numbers:
INPUT "First number - ", n1
INPUT "Second number - ",n2
answer = n1 + n2
PRINT "answer = ";answer
Math in a Loop:
CLS
PRINT "This program multiplies two numbers"
SLEEP 2
DO
PRINT
INPUT "enter first number - ", n1
INPUT "enter second number - ", n2
answer = n1 * n2
CLS
PRINT "Answer = " ;answer
LOOP
In this example n1, n2 and answer are all variables.
The program repeats everthing between DO and LOOP.
To make it stop, press Ctrl and Pause at the same time.
Remember to use SHIFT F5 to run your program.
Area of a rectangle:
PRINT " Calculate the area of a rectangle "
CLS
INPUT "Enter Units",u$
INPUT "Enter length",l
INPUT "Enter width",w
a = l * w
PRINT "area = ";a;";u$;"^";2