CLS
a = 2 * 3
PRInt a
End
If you type PRInt, QBasic changes it to PRINT [saves you
time] so you can just type print, and it will go caps on it own.
Thats prety much basic math,Ponder this over, think of it as
a first assignment, make a calculator! [easer said then done]
REM or ' are used to make comments, i will use this on this
site to show my comments, they dont have to be typed in your
program! But including comments is a GOOD habit!
CLS
a=3*2*5 'If you dont have spaces Qbasic will add them!
b=a/2-5
print b
end
Math Table
Divide /
Multiply *
Add +
Subtract -
There are more, but we will skip them for now.
Hers a little more complex problem! Try this one out.
CLS
a=4*((4*5)/10)+6
PRINT a
Output should be something like. 14
Hers how,
4*5 = 20
20 / 10 = 2
4*2=8
8+6=14
Here is why,
if you remeber BEDMAS
Brackets
Exponets
Division
Multiplication
Addition
Subtraction
That is the order math is done.
So it did what was in the ( ) first, and if you put
((a*b)/c)
It will do a*b, then whatever a*b is /c
This can be useful at times!
Mess around with it, then you will completely understand!
Continue