Visual Basic: Mathematical Operations
In Visual Basic mathematical operations are the same as they are in many other programming languages:
"+" - Addition (e.g. 2+2 = 4)
"-" - Subtraction (e.g. 2-2 = 0)
"*" - Multiply (e.g. 2*5 = 10)
"/" - Division (e.g. 10/2 = 5)
There are also some other mathematical operations that you should know about:
"\" - Integer Division (diving with whole numbers)
"^" - Exponential (e.g. 2^4=16 (2 to the power of 4))
With these you can do all types of things with different numbers and variable numbers.
A good example of using these is to calculate a BMI using height (a variable) and weight (a variable).
If the weight was in KG, and the height was in metres then you could use something like this:
bmi = (weight) / (height ^ 2)
Back to Visual Basic

