# Answer to Question #32723 in Visual Basic for Noor sihra

Question #32723

How '/' operator is different from '\'?

Expert's answer

VB.NET offers two division operators: / and .The forward slash or right-facing division operator (/) returns a

floating-point answer. In other words, this operator allows for a fractional

answer; there is no remainder. Thus, if you use this operator to divide 12 by 5

(12/5), the answer is 2.4. This answer is returned as a Double.

The backslash or left-facing division operator () performs integer division;

that is, it returns an integer value and discards any remainder. Thus, if you

use the integer division operator to divide 12 by 5 (125), the return value is

truncated to the integer 2, with VB.NET discarding the remainder of 4. However,

no cast is needed (even with Option Strict On) because you've explicitly asked

for the integer value.

floating-point answer. In other words, this operator allows for a fractional

answer; there is no remainder. Thus, if you use this operator to divide 12 by 5

(12/5), the answer is 2.4. This answer is returned as a Double.

The backslash or left-facing division operator () performs integer division;

that is, it returns an integer value and discards any remainder. Thus, if you

use the integer division operator to divide 12 by 5 (125), the return value is

truncated to the integer 2, with VB.NET discarding the remainder of 4. However,

no cast is needed (even with Option Strict On) because you've explicitly asked

for the integer value.

## Comments

## Leave a comment