Module 4 - Numeric Operators - PROG78002 Introduction to Programming With Java
Module 4 - Numeric Operators - PROG78002 Introduction to Programming With Java
NUMERIC OPERATORS
The operators for numeric data types include the standard arithmetic operators:
addition (+), subtraction (-), multiplication (*), division (/) and remainder (%).
When both operands of a division are integers, the result of the division is the
quotient and the fractional part is truncated.
For example a
https://slate.sheridancollege.ca/d2l/le/content/657541/viewContent/8995324/View 1/2
2/6/2020 Numeric Operators - PROG78002 Introduction to Programming with Java
Another use of the remainder is used to determine the day of the week.
If today is Saturday (the 6th day of the week) and you were going to meeting 7 days
from now you will meet on Saturday ( the 6th day) again.
(6+7) %7 = 6
If you were to meeting someone in 10 days from now, given that today is Saturday,
what day will it be.
https://slate.sheridancollege.ca/d2l/le/content/657541/viewContent/8995324/View 2/2