/* * CISC102-12 * conversion_dowhile.c * This program converts Celsius temperatures to Fahrenheit. * modified to use a do-while loop, but it's a little ugly. * 06.13.05 */ #include #define STOP_VALUE -99 int main() { double celsius; double fahrenheit; printf("Welcome!\n"); do { printf("Enter a temperature in F (Enter %d to stop): ", STOP_VALUE); scanf("%lf", &fahrenheit); celsius = (5/9.0) * ( fahrenheit - 32 ); printf("%.2lf degrees F is %.2lf degrees C.\n", fahrenheit, celsius); /* computes the temperature for all values, even the STOP_VALUE */ } while( fahrenheit != STOP_VALUE ); printf("Thank you for using my program.\n"); return 0; }