Write a function that takes one argument-F for Fahrenheit-and computes the result of the following equation (converting the temperature to Celsius). C = (F – 32) * (5 / 9)
______ tempConverter(float ________) {
  _____ _______ = ______________
  _____________________________
}
Answer:
void setup() {
  float temp = tempConverter(50);
  println(temp);
}

float tempConverter(float farenheit) { 
  float celsius = (farenheit - 32) * (5.0/9.0);
  return celsius;
} 

2 Comments

»

  1. Quick question here -

    In the “Answer,” shouldn’t it read:

    float celsius = (farenheit – 32) * (5.0/9.0);

    I could be wrong, but just wanted to check. Thanks!

    Comment by Aaron — September 20, 2008 @ 8:00 pm

  2. Yup, that’s right! Thanks, fixed now.

    Comment by admin — September 20, 2008 @ 8:08 pm

Leave a comment