首先,设置华氏温度 -
double fahrenheit = 97; Console.WriteLine("Fahrenheit: " + fahrenheit);
现在将其转换为摄氏度 -
celsius = (fahrenheit - 32) * 5 / 9;
您可以尝试运行以下代码将华氏温度转换为摄氏度。
现场演示
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class MyApplication { static void Main(string[] args) { double celsius; double fahrenheit = 97; Console.WriteLine("Fahrenheit: " + fahrenheit); celsius = (fahrenheit - 32) * 5 / 9; Console.WriteLine("Celsius: " + celsius); Console.ReadLine(); } } }
Fahrenheit: 97 Celsius: 36.1111111111111
以上就是将华氏温度转换为摄氏度的 C# 程序的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 //m.sbmmt.com/ All Rights Reserved | php.cn | 湘ICP备2023035733号