/* * CISC102-12 * 06.06.05 * conversion.1.c * This program converts Celsius temperatures to Fahrenheit. * - modified 06.13.05 to accept user input */ #include /* STOP_VALUE is the sentinel for our loop */ #define STOP_VALUE -99 int main() { double celsius; double fahrenheit; printf("Welcome!\n"); printf("Enter a temperature in F (Enter %d to stop): ", STOP_VALUE); scanf("%lf", &fahrenheit); /* Keep prompting for user input as long as the input * is not equal to the STOP_VALUE. */ while( fahrenheit != STOP_VALUE ) { celsius = (5/9.0) * ( fahrenheit - 32 ); printf("%.2lf degrees F is %.2lf degrees C.\n", fahrenheit, celsius); printf("Enter a temperature in F (Enter %d to stop): ", STOP_VALUE); scanf("%lf", &fahrenheit); } printf("Thank you for using my program.\n"); return 0; }