...

/

Solution: Find Remainder and Quotient of an Integer

Solution: Find Remainder and Quotient of an Integer

This lesson presents a solution to the coding challenge given in the previous lesson.

We'll cover the following...

Solution #

We can use the / operator for division to obtain the quotient and the % operator to get the remainder.

Press + to interact
import std.stdio;
void DivideInteger() {
int first = 7;
int second = 3;
int quotient = first / second;
int remainder = first % second;
write(first," = ",second," multiplied by " ,quotient," plus " ,remainder);
}

Code

...