Question: (Temperature Conversions) Write a program that converts integer Fahrenheit temperatures from 0 to 212 degrees to floating-point Celsius temperatures with 3 digits of precision. Perform

(Temperature Conversions) Write a program that converts integer Fahrenheit temperatures from 0 to 212 degrees to floating-point Celsius temperatures with 3 digits of precision. Perform the calculation using the formula

celsius = 5.0 / 9.0* (fahrenheit - 32);

The output should be printed in two right-justified columns of 10 characters each, and the Celsius temperatures should be preceded by a sign for both positive and negative values.

#include

int main()

{

//Store temp in Fahrenheit

int temp_fahrenheit;

//store temp in Celsius

float temp_celsius;

printf(" Temperature conversion from Fahrenheit to Celsius is given below: ");

printf(" %10s\t%12s ", "Fahrenheit", "Celsius");

//For loop to convert

for (temp_fahrenheit = 0; temp_fahrenheit <= 212; temp_fahrenheit++)

{

temp_celsius = 5.0 / 9.0 *(temp_fahrenheit - 32);

printf("%10d\t%12.3f ", temp_fahrenheit, temp_celsius);

}// End loop

return 0;

}

How would I program this to request the temperature wanted to convert? for example request farhenheit temp from user and return the celsius temperature for that temp?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!