using System;
namespace MyFirstProgram
{
internal class Program
{
static void Main(string[] args) // main method
{
// 피타고라스
Console.WriteLine("Enter side A: ");
double a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter side B: ");
double b = Convert.ToDouble(Console.ReadLine());
double c = Math.Sqrt((a * a) + (b * b));
Console.WriteLine("The hypotenuse is : " + c);
Console.ReadKey();
}
}
}
Math클래스를 이용해 피타고라스의 정리 - 빗변 길이 구하기
728x90
'언어 > [C#]' 카테고리의 다른 글
[C#] if 조건문 if - else if - else (0) | 2023.03.01 |
---|---|
[C#] String 함수 ToUpper(), ToLower(), Replace(), Insert(), Length, Substring() (0) | 2023.03.01 |
[C#] 랜덤 Random (Random.Next(), Random.NextDouble()) (0) | 2023.02.25 |
[C#] Math 클래스 (Pow, Sqrt, Abs, Round, Ceiling, Floor, Max, Min) (0) | 2023.02.25 |
[C#] 연산자 +, -, *, /, ++, +=, -- -=, *=, /= (0) | 2023.02.25 |