3
06/11/2024 6:29 pm
Topic starter
Write an expression that checks if given point (x, y) is inside a circle K({0, 0}, 2).
Examples:
1 Answer
2
06/11/2024 6:30 pm
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); } }