主页
C 语言
C 实际示例
demo_functions_param_reallife
运行 ❯
×
更改方向
保存代码
更改主题
#include <stdio.h> // Function to convert Fahrenheit to Celsius float toCelsius(float fahrenheit) { return (5.0 / 9.0) * (fahrenheit - 32.0); } int main() { // Set a fahrenheit value float f_value = 98.8; // Call the function with the fahrenheit value float result = toCelsius(f_value); // Print the fahrenheit value printf("Fahrenheit: %.2f\n", f_value); // Print the result printf("Convert Fahrenheit to Celsius: %.2f\n", result); return 0; }
华氏温度: 98.80
华氏温度转换为摄氏温度: 37.11