Expressions and Variables

Variable Reassignment


Using a single variable convert a temperature of 42 degrees Fahrenheit to Celsius. To do this you’ll need to:

  1. Assign the number 42 to a variable
  2. Subtract 32 from it and assign that value back to the same variable
  3. Divide the current value by 9 and assign that value back to the same variable
  4. And then multiple the current value by 5 and assign that value back to the same variable
  5. Print the temperature in degrees Celsius

The answer should be 5.55555. If it isn’t then that pesky integer division problem is probably tripping you up.

Now do the same thing again, but this time using combined operators, and a starting temperature of 98.6 degrees.