See my code below:
Code:
/*
* ======================================================================
*
* Filename: ex08.c
*
* Description: This program asks the user to enter a Fahrenheit
* temperature and then converts it into Celsius and
* Kelvin temperature.
*
* Version: 1.0
* Created: 03/20/2013 04:55:38 PM
* Revision: none
* Compiler: gcc
*
* Author: Vincent
* Organization: Vincent`s Workshop
*
* ======================================================================
*/
#include <stdio.h>
void Temperatures(double temp_F);
int main(void) {
double temp;
printf("Enter a temperature in Fahrenheit:\n");
scanf("%lf", &temp);
while ( temp /* some code here? */ ) {
Temperatures(temp);
printf("Enter a temperature in Fahrenheit "
"(enter a nonnumeric value to exit):\n");
scanf("%lf", &temp);
}
return 0;
}
void Temperatures(double temp_F) {
double temp_C;
double temp_K;
const double C_SCALE = 1.8;
const double C_ADD = 32.0;
const double K_ADD = 273.16;
temp_C = (temp_F - C_ADD) / C_SCALE;
temp_K = temp_C + K_ADD;
printf("%.2f F is %.2f C and %.2f K.\n", temp_F, temp_C, temp_K);
}