Answer

Notice how similar this is to the ``main'' function you've already seen.

float getKelvin () {

  float temp;

  temp = -1.0;
  while (temp <= 0) {
    printf("Please enter a (positive) temperature in degrees Kelvin: ");
    scanf("%f", &temp);
  }

  return(temp);

}

Return to lesson.



Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah