educative.io

Quiz in the Arithmetic Operator section

int main() {  char operand1 = 'n';  char operand2 = 'C';  cout << "Division = " << operand1 / operand2 << endl;  cout << "Modulus = " **<< operand1 % operand2** << endl;  return 0;}

The quiz in the Arithmetic Operators section marks (B) as being correct. The code uses the mod (%) operator between the two operands 1 and 2. The correct answer in the quiz alludes to a subtraction operator. Am I missing something?

Type your question above this line.

Course: https://www.educative.io/collection/10370001/6619096843026432
Lesson: https://www.educative.io/collection/page/10370001/6619096843026432/5653941187510272

The ASCII value of n = 110
The ASCII value of C = 67

So the mod(%) operator returns the division remainder of 110/67.
Which just by coincidence is equal to 110-67 (Hence the subtraction operator as suggested by you)

If you try with a different number, let’s say operand1 = 122 and operand2 = 60.
In this case
operand1%operand2 = 2.