Answer to Question #32723 in Visual Basic for Noor sihra

Question #32723
How '/' operator is different from '\'?
1
Expert's answer
2013-07-03T08:56:37-0400
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.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS