3
06/11/2024 6:29 오후
주제 스타터
Write an expression that checks if given point (x, y) is inside a circle K({0, 0}, 2).
예시:

1개 답글
2
06/11/2024 6:30 오후
Here is my solution:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class PointInACircle
{
static void Main()
{
Console.WriteLine("Enter point x for circle K({0, 0}, 2):");
double x = double.Parse(Console.ReadLine());
Console.WriteLine("Enter point y for circle K({0, 0}, 2):");
double y = double.Parse(Console.ReadLine());
bool check = Math.Pow((x - 0), 2) + Math.Pow((y - 0), 2) <= Math.Pow(2, 2);
Console.WriteLine("Point inside? {0}", check);
}
}
