SchoolFreeware's QBasic Tutorial
Series - Tutorial 2 Printing Math
These are the math operators used within
QBasic.
This tutorial will also use some math functions.
The absolute value and the square root will be used.
The code used within Tutorial 2 can be
downloaded for free at SchoolFreeware.com
This tutorial we'll use QB64
running on Windows 7.
I will start off by clearing the screen.
I will print some math.
5 + 10.
You do not need to put anything within quotes because you are not printing verbatim to the screen.
Go ahead with some subtraction and other math.
print 6 - 5 
print 7 * 6 
print 10 / 2 
print 2 ^ 3
print the square root of 25
print the absolute value of negative 5
Now go ahead and run.
Everything checks out
QBasic also follows the order of operations.
For example print 5 * 2 + 10
Print (5 * 2) + 10
Print 5 * (2 + 10)
Go Run
You see that we do follow the order of operations.
If I were to go ahead and try to do something that the computer is not capable of handling like 100 ^ 100 ...
Go ahead and Run
We get an infinity
For those running QBasic 1.1 you are probably back in the IDE with an error message stating overflow or something to that effect.
