fork download
  1. //April Foster
  2. //January 31, 2023
  3. //Lab 1 - Program 2 - User Input and Math
  4. /*This program will convert the temperature from Fahrenheit to Celsius*/
  5.  
  6. #include <stdio.h>
  7.  
  8. int main()
  9. {
  10. float degC, degF; //floating point (real number) values
  11.  
  12. //Input temperature in Fahrenheit//
  13. printf("\n\n Enter temperature in Fahrenheit: \n");
  14. scanf("\n %f", &degF);
  15.  
  16. degC = (degF - 32) * 5 / 9; //Fahrenheit to Celsius conversion formula//
  17.  
  18. printf("\n %.2f degF = %.2f degC \n", degF, degC); //Print the value of Celsius
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5468KB
stdin
Standard input is empty
stdout

 Enter temperature in Fahrenheit: 

 0.00 degF = -17.78 degC