반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Numerics; | |
class Program | |
{ | |
static void Main() | |
{ | |
// 복소수 생성 | |
Complex c1 = new Complex(2, 3); // 2 + 3i | |
Complex c2 = new Complex(4, -2); // 4 - 2i | |
// 복소수 사칙연산 | |
Complex sum = c1 + c2; // 6 + 1i | |
Complex difference = c1 - c2; // -2 + 5i | |
Complex product = c1 * c2; // 14 + 8i | |
Complex division = c1 / c2; // 0.3 + 0.7i | |
// 복소수 출력 | |
Console.WriteLine("c1: " + c1); | |
Console.WriteLine("c2: " + c2); | |
Console.WriteLine("Sum: " + sum); | |
Console.WriteLine("Difference: " + difference); | |
Console.WriteLine("Product: " + product); | |
Console.WriteLine("Division: " + division); | |
} | |
} |
반응형