Section 3 Notes and Plans
- Section 3 Video 3 Notes and Planning
- Arithmetic Operations in Programming
- Arithmetic operations exist in most programming languages.
- Include: Subtraction, Addition, Multiplication, Division, Getting the Remainder
- All operations are represented by symbols.
- In all of these scenarios, a/b can be an expression or just a simple number.
- Just like how numbers can be assigned to variables, a set of operations involving different values and numbers can also be assigned to a variable
- Idea for Hacks
- Arithmetic Operations in Programming
Section 3 Video 3 Notes and Planning
Arithmetic Operations in Programming
Arithmetic operations exist in most programming languages.
Include: Subtraction, Addition, Multiplication, Division, Getting the Remainder
-
-
Subtraction: “-“
-
Ex:
a - b
-
Addition: “+”
-
Ex:
a + b
-
Multiplication: “*“
-
Ex:
a * b
-
Division: /
-
Ex:
a / b
-
Getting the Remainder: MOD
- Ex:
a MOD b
In all of these scenarios, a/b can be an expression or just a simple number.
Just like how numbers can be assigned to variables, a set of operations involving different values and numbers can also be assigned to a variable
Ex:
num1 ← 20
num2 ← num1 + 98
num3 ← num2 * num1 + 8 / num2
Arithmetic operations in programming are performed in the same order as operations in mathematics. For example, operations in parentheses should be done first.