Arithmetic Operators in Visual Basic

Let’s now discuss the different kinds of operators under the Arithmetic function

There are 3 groups of operators in Visual Basic: we have the arithmetic operators, relational operators and the logical operators, but this article will only discuss about the arithmetic operators.

Arithmetic Operators

Addition (+) plus sign

Addition is used to add two or more numbers (basic math). But in visual basic + sign is also used to add the value of two or more variables (numbers and text).


In our example above we: the compute SUM button will compute the sum of the Value 1 and Value 2, for example you will input 1 and 4, the result would be 5.

The add value button will combine the value of the two text field, for example you will input Hi and everybody the result would be Hi everybody.

Subtraction (-)

Subtraction operator is used to get the difference of the two numbers.

Subtraction Operator
Subtraction Operator

On the example above the user enter 10 on the Value 1 and 5 on the Value 2, the result will display if the user will click the Subtract button and the result for that is 5.

If you will enter a number in Value 2 which is higher to the Value 1 the result will be negative.

Multiplication (*)

Multiplication is a repeated addition. For example 2 * 3 is similar to 2 + 2 + 2. The result of multiplying two or more numbers is called a product. The multiplication process is represented by an asterisk.

Multiplication Operator
Multiplication Operator

You can also multiply a whole number and a decimal.

Division (/) (\)

Division in simplest form is the process of splitting the group into equal parts. In visual basic there are two kinds of division: the real division and the integer division.

Real division is represented by (/) a forward slash sign this process will retain the decimal point of the quotient. Example: 10 / 4 = 2.5

Division Operator
Division Operator

In integer division (division with no remainder) it is represented by (\) a backslash. It will ignore the decimal of the quotient and return only a whole number. Example 10 \ 4 =2

The Exponent Operator (^)

In visual basic the exponent operator is represented by ^ caret. It includes the base number and the exponent (to the power of). Example: 102 = 100


Modulo the remainder operator (Mod)

The Mod operator will get and display the remainder of the number after division. Example: 10 / 3, the remainder is 1.




, , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.