Division Operator

Dart Arithmetic Division Operator takes two numbers as operands and returns the quotient for the division of left operand by right operand.

Symbol

/ symbol is used for Division Operator.

Syntax

The syntax for Division Operator is

</>
Copy
operand_1 / operand_2

The operands must be numbers.

Examples

In the following example, we take two integers:n1 and n2, and find the quotient of the division n1 / n2 using Arithmetic Division Operator.

main.dart

</>
Copy
void main() {
    var n1 = 14;
    var n2 = 3;
    var output = n1 / n2;
    print('n1 / n2 = $output');
}

Output

n1 / n2 = 4.666666666666667

In the following example, we divide a value of type double by a value of type integer.

main.dart

</>
Copy
void main() {
    var n1 = 14.523;
    var n2 = 3;
    var output = n1 / n2;
    print('n1 / n2 = $output');
}

Output

n1 / n2 = 4.841

Conclusion

In this Dart Tutorial, we learned how to use Division Operator to find the quotient in the division operation of given two numbers.