Opening
A Rocket Lost to a Calculation

- A real photograph or video frame of the Ariane 5 Flight 501 launch shortly after the rocket breaks apart, with the launch plume and fragments visible against the sky. Keep the rocket and its expanding plume prominent; include no labels, arrows, or explanatory text.
Slide 1
Symbols That Calculate and Update

- An operator is a symbol that performs an operation on values or variables; for example, `+` adds two numbers.
- Arithmetic operators calculate: `+`, `-`, `*`, `/`, and `%` mean addition, subtraction, multiplication, division, and remainder; `17 % 5` gives `2`.
- An assignment operator stores or updates a variable: `score += 4` adds 4 to the current score, while `=` assigns a value; the Ariane 5 failure shows why calculated values and their storage limits matter.
- The `-=` operator is subtraction assignment: it subtracts a value from a variable's current value and stores the result back in that variable.
- The `*=` operator is multiplication assignment: it multiplies a variable's current value by a value and stores the result back in that variable.
- operator
- — A symbol that performs an operation on values.
- arithmetic operators
- — Symbols used to calculate numeric results.
- assignment operator
- — A symbol that stores or updates a variable's value.
Check for understanding
Check Your Understanding
Slide 2
Comparisons, Text, and Comments

- Comparison operators `==`, `!=`, `>`, `<`, `>=`, and `<=` compare values and produce `true` or `false`; for example, `8 >= 8` is `true`.
- The `+` operator adds numeric values but joins strings: `4 + 3` is `7`, while `"Route " + 3` is `"Route 3"`.
- A comment explains code without running: `// note` is single-line and `/* note */` is multi-line; `int points = 12; points += 5; Console.WriteLine(points);` prints `17`.
- comparison operators
- — Symbols that compare values and produce true or false.
- strings
- — Text values represented between quotation marks.
- comment
- — Code text that explains but does not execute.
Check for understanding
Check Your Understanding
Slide 3
Practice: Update a Supply Count

- A robotics club has 28 bolts and uses 9; `bolts -= 9` leaves 19 because subtraction assignment updates the stored value.
- Multiplication calculates equal groups: a pack holds 6 batteries, so `packs * 6` gives 24 batteries for 4 packs.
- Increment (`++`) and decrement (`--`) change an integer by one; starting at 19, `bolts++` makes the count 20.
- subtraction assignment
- — An update that subtracts from a variable's current value.
- multiplication
- — Repeated addition used to calculate a total.
- increment
- — An increase of one in a variable's value.
Check for understanding
Check Your Understanding
Slide 4
Practice: Compare Sensor Readings

- A greenhouse sensor reads 31 degrees and its alert limit is 30; the greater-than comparison `reading > limit` is `true` because 31 is larger than 30.
- If the required battery charge is 60 and the sensor reports 60, the greater-than-or-equal comparison `charge >= 60` is `true`; equality meets the minimum.
- A comparison can guide a decision: `int charge = 58; Console.WriteLine(charge >= 60);` prints `False`.
- comparison
- — An evaluation of two values using a comparison operator.
- Boolean
- — A value that is either true or false.
- threshold
- — A limit used to evaluate a measurement.
Check for understanding
Check Your Understanding
Slide 5
Combine Conditions with Logic

- The logical AND operator `&&` is true only when both conditions are true; a device must be charged and connected for `charged && connected` to be true.
- The logical OR operator `||` is true when at least one condition is true; `weekend || holiday` is true if either condition is true.
- The logical NOT operator `!` reverses a Boolean result, so if `doorOpen` is `false`, `!doorOpen` is `true`; these operators combine or reverse comparisons.
- logical AND
- — True only when both conditions are true.
- logical OR
- — True when at least one condition is true.
- logical NOT
- — Reverses a Boolean value.
Check for understanding
Check Your Understanding
Slide 6
Useful Methods in Math

- `Math.Max(a, b)` returns the larger value and `Math.Min(a, b)` returns the smaller; for 14 and 9, they return 14 and 9.
- `Math.Sqrt(x)` returns a square root, so `Math.Sqrt(81)` returns `9`; `Math.Abs(x)` returns distance from zero, so `Math.Abs(-6)` returns `6`.
- `Math.Round(x)` rounds a floating-point value to the nearest whole number; `Math.Round(7.6)` returns `8`.
- Math.Max
- — Returns the larger of two values.
- Math.Sqrt
- — Returns the square root of a value.
- Math.Round
- — Rounds a decimal value to a nearby whole number.
Check for understanding
Check Your Understanding
Slide 7
Practice: Calculate a Ramp Length

- A square platform has an area of 144 square units; `Math.Sqrt(144)` gives a side length of 12 units.
- A sensor records a change of -3.5 units; `Math.Abs(-3.5)` gives a magnitude of 3.5 units without the negative sign.
- For an estimated duration of 8.7 minutes, `Math.Round(8.7)` gives 9; the C# call `Console.WriteLine(Math.Sqrt(81));` prints `9`.
- Math.Sqrt
- — Returns a square root.
- Math.Abs
- — Returns a number's nonnegative distance from zero.
- Math.Round
- — Rounds a value to the nearest whole number.
Check for understanding
Check Your Understanding
Slide 8
Practice: Check a Drone Launch

- A drone may launch only when its battery is at least 70 and its area is clear; `battery >= 70 && areaClear` requires both conditions.
- A warning can appear when wind is strong or rain is detected; `strongWind || rainDetected` is true when either condition is true.
- If the landing zone is not occupied, `!zoneOccupied` is true; `Math.Sqrt(100)` is 10, and `Console.WriteLine(Math.Sqrt(100));` prints `10`.
- The true category means an expression evaluates to true; the false category means an expression evaluates to false.
- logical AND
- — Requires both conditions to be true.
- logical OR
- — Requires at least one condition to be true.
- logical NOT
- — Reverses a true or false result.
Check for understanding
Check Your Understanding
Check for understanding
Solo Run: Operators, Logic, and Math
Exit check