fork download
  1. //********************************************************
  2. //
  3. // C Midterm - Question 7
  4. //
  5. // Name: Maya Mahin
  6. //
  7. // Class: C Programming, Spring 2025
  8. //
  9. // Date: March 23, 2025
  10. //
  11. // Description: Program which facilitates the conversion of fahrenheit to
  12. // celsius temperatures and vice versa
  13. //
  14. //********************************************************
  15.  
  16. #include <stdio.h>
  17.  
  18. float toCelsius(float fahrenheitTemp);
  19. float toFahrenheit(float celsiusTemp);
  20.  
  21. int main(void) {
  22. float retVal1=toCelsius(32);
  23. float retVal2=toFahrenheit(0);
  24. return 0;
  25. }
  26.  
  27. //**************************************************************
  28. // Function: toCelsius
  29. //
  30. // Purpose: Receives a temperature in fahrenheit, converts it
  31. // to Celsius and returns the converted value
  32. //
  33. // Parameters:
  34. //
  35. // temp - input temperature in fahrenheit
  36. //
  37. // Returns: temp_convert - input temperature in celsius
  38. //
  39. //**************************************************************
  40. float toCelsius(float fahrenheitTemp){
  41. float celsiusTemp=(fahrenheitTemp - 32) * 5/9;
  42. return celsiusTemp;
  43. }
  44. //**************************************************************
  45. // Function: toFahrenheit
  46. //
  47. // Purpose: Receives a temperature in celsius, converts it
  48. // to Fahrenheit and returns the converted value
  49. //
  50. // Parameters:
  51. //
  52. // temp - input temperature in celsius
  53. //
  54. // Returns: temp_convert - input temperature in fahrenheit
  55. //
  56. //**************************************************************
  57. float toFahrenheit(float celsiusTemp){
  58. float fahrenheitTemp=(celsiusTemp - 32) * 5/9;
  59. return fahrenheitTemp;
  60. }
  61.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty