A simple program that prints the corresponding place value of each digit in a three-digit number stored in user_val.
This serves as a gentle, but informative excercise to challenge my understanding of the MODULO operator (%).
Now, you may ask: "What is the MODULO operator?"
Well, MODULO is a basic arthmetic operator (i.e., +,-,*,/) that evaluates the remainder of the division of two integer operands.
For example:
- 18 % 10 is 8. Why? Because 18 / 10 is 1 with a remainder of 8.
- 90 % 90 is 0. Because 90 / 90 is 1 with a remainder of 0.
- 1 % 2 is 1. Because 1 / 2 is 0 with a remainder of 1.
- 100 % (1 // 2) is undefined. Because using PEMDAS, (1 // 2 ) evaluates to 0. 100 % 0 is undefined (as 100 / 0 is undefined), thus causing the program to terminate.