첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.00MB

▶ Program.cs

using System;

namespace TestProject
{
    /// <summary>
    /// 프로그램
    /// </summary>
    class Program
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Static
        //////////////////////////////////////////////////////////////////////////////// Private

        #region 화씨 구하기 - GetFahrenheit(celsius)

        /// <summary>
        /// 화씨 구하기
        /// </summary>
        /// <param name="celsius">섭씨</param>
        /// <returns>화씨</returns>
        private static double GetFahrenheit(double celsius)
        {
            double fahrenheit = Math.Round((celsius * 1.8d) + 32d, 2);

            return fahrenheit;
        }

        #endregion
        #region 섭씨 구하기 - GetCelsius(fahrenheit)

        /// <summary>
        /// 섭씨 구하기
        /// </summary>
        /// <param name="fahrenheit">화씨</param>
        /// <returns>섭씨</returns>
        private static double GetCelsius(double fahrenheit)
        {
            double celsius = 5d / 9d * (fahrenheit - 32d);

            return celsius;
        }

        #endregion
        #region 프로그램 시작하기 - Main()

        /// <summary>
        /// 프로그램 시작하기
        /// </summary>
        private static void Main()
        {
            double celsius    = 36d;
            double fahrenheit = GetFahrenheit(celsius);

            celsius = GetCelsius(fahrenheit);

            Console.WriteLine($"{celsius   }°C");
            Console.WriteLine($"{fahrenheit}°F");
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요