먼저 섭씨 온도를 설정합니다 -
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