C# 程式執行攝氏度轉華氏度


首先,設定攝氏度 −

double celsius = 36;
Console.WriteLine("Celsius: " + celsius);

現在將其轉換為華氏度

fahrenheit = (celsius * 9) / 5 + 32;

您可以嘗試執行以下程式碼來將攝氏度轉換為華氏度。

示例

即時演示

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demo {

   class MyApplication {

      static void Main(string[] args) {

         double fahrenheit;

         double celsius = 36;
         Console.WriteLine("Celsius: " + celsius);

         fahrenheit = (celsius * 9) / 5 + 32;
         Console.WriteLine("Fahrenheit: " + fahrenheit);

         Console.ReadLine();
      }
   }
}

輸出

Celsius: 36
Fahrenheit: 96.8

更新於: 19-6-2020

7K+ 瀏覽量

啟動您的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.