# C programs

1. if-else structure Write a program that converts between Celsius, Fahrenheit, and Kelvin temperatures. It must prompt the user for a temperature, and a letter the represents the units that input is in (‘C’, ‘c’, ‘F’, ‘f’, ‘K’, or ‘k’). It then converts the input temperature to both of the other scales, and displays the result. Use an “if-else if” structure (not a switch statement) to decide which calculations must be done. Example output should look similar to this: Temperature: 98.6 Units: f F: 98.6 C: 37 K: 310.15 2. for loop, tabular output Write a program that produces a wind-chill chart. This is a chart that shows the “wind chill temperature” for a given air temperature (in degrees Fahrenheit) and wind speed (in miles per hour). A sample is shown below. Your program must prompt the user for minimum and maximum temperatures, and minimum and maximum wind speeds; then produce a two-dimensional chart like the one below. Temperatures are in increments of 2 degrees; wind speeds are in increments of 5 mph. Notice that the temperatures range from highest (top row) to lowest (bottom row). A detailed description of wind chill is available from this NOAA webpage. The formula for calculating wind chill is: WindChill = 35.74 + (0.6215 × Temp) – (35.75 × Wind0.16) + (0.4275 × Temp × Wind0.16) Note that you must take a non-integer power of the wind speed. To do this, you need the pow() function, available in the header file. You will also need to link in the math library by using the -lm flag, like this: gcc -g -Wall -o windchill windchill.c -lm Min, Max temperature: -8 8 Min, Max wind: 3 23 T W 3.0 8.0 13.0 18.0 23.0 —— —— —— —— —— 8.0 | 2.2 -4.4 -8.0 -10.6 -12.7 6.0 | -0.1 -6.8 -10.6 -13.2 -15.3 4.0 | -2.4 -9.3 -13.1 -15.8 -18.0 2.0 | -4.6 -11.7 -15.6 -18.4 -20.6 0.0 | -6.9 -14.1 -18.1 -21.0 -23.3 -2.0 | -9.1 -16.6 -20.7 -23.6 -26.0 -4.0 | -11.4 -19.0 -23.2 -26.2 -28.6 -6.0 | -13.7 -21.4 -25.7 -28.8 -31.3 -8.0 | -15.9 -23.9 -28.3 -31.4 -33.9