If I did
would 0 be a possible outcome? 4?Code:cout << rand()%4;
Printable View
If I did
would 0 be a possible outcome? 4?Code:cout << rand()%4;
Possible outcomes are 0, 1, 2, 3. Four is not possible.
mod % returns the reminder. Therefore, 8 % 4 has a zero remainder. While the remainder of 7 % 4 is 3 and 9 % 4 is 1. Four can never be a reminder.