For this program you will perform a set of conversions from Fahrenheit to Celsiu
ID: 3692306 • Letter: F
Question
For this program you will perform a set of conversions from Fahrenheit to Celsius or Celsius to Fahrenheit. The user will first enter an F to convert from Fahrenheit to Celsius or a C to convert from Celsius to Fahrenheit. Then the user will enter three integer values. The first integer will be the lower temperature. The second integer will be the higher temperature. And the third integer will be the incremental temperature change. Your program will then convert all of the temperature within that range based on the incremental temperature change. Here are a few sample executions Equation for Fahrenheit to Celsius: C=(F-32)/1.8 Equation for Celsius to Fahrenheit: F=C*1.8 +32
Explanation / Answer
/*To convert Fahrenheit to Celsius, subtract 32 degrees and divide by 1.8.
To convert Celsius to Fahrenheit, multiply by 1.8 and add 32 degrees.*/
CODE:
#include<stdio.h>
main ()
{
float temp_c, temp_f;
printf ("Enter the value of Temperature in Celcius: ");
scanf ("%f", &temp_c);
temp_f = (1.8 * temp_c) + 32;
printf ("The value of Temperature in Fahreinheit is: %f", temp_f);
}
//*Write a program to convert the given temperature in Fahrenheit to Celsius . */
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.