2024-04-30 08:40:42 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2024-05-02 09:52:00 -04:00
|
|
|
// creating a function to convert celsius to fahrenheit
|
|
|
|
|
2024-04-30 08:40:42 -04:00
|
|
|
double to_fahr(double celsius)
|
|
|
|
{
|
|
|
|
return (celsius * 9.0 / 5.0) + 32.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
float fahr, celsius;
|
|
|
|
int lower, upper, step;
|
|
|
|
|
|
|
|
lower = 0;
|
|
|
|
upper = 300;
|
|
|
|
step = 20;
|
|
|
|
|
|
|
|
celsius = lower;
|
|
|
|
printf("%10s %7s\n", "Fahrenheit", "Celsius");
|
|
|
|
while (celsius <= upper)
|
|
|
|
{
|
|
|
|
printf("%10.0f %7.1f\n", to_fahr(celsius), celsius);
|
|
|
|
celsius = celsius + step;
|
|
|
|
}
|
|
|
|
}
|