3.3-Working with Binary Arithmetic Operators Flashcards
📝️ What is a binary operator?
A binary operator is an operator that operates on two operands and manipulates them to return a result.
📝️ What is the binary operator’s syntax?
operand1 BI-OPERATOR operand2
📝️ What are the Arithmetic operators and its precedence?
- > Multiplication Operator *
- > Division Operator /
- > Remainder Operator %
- > Addition Operator +
- > Substraction Operator -
⚠️The multiplicative operators (*, /, %) have a higher order of precedence than the additive ones (+, -)
What does the Modulus Operator return?
It returns the remainder when two numbers are divided.
🧠️🤯️⚠️📣️ Be sure to understand the difference between arithmetic division and modulus.
📝️ What does the expression floor value means?
- > For integer values, division results in the floor value
- > It just means the value without anything after the decimal point.
👀️ e.g: The floor value is 4 for each of the values 4.0, 4.5, and 4.9999999.
🧠️🤯️⚠️📣️ What does Numeric promotion means?
🚀️ When applying an arithmetic operator ( +|-||/|% ) the result type promotes to int by default**
🚀️ If either operand is long|float|double type, the result is converted to long|float|double