coasterka

#3PointInACircle

Mar 14th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. static void Main()
  2.         {
  3.             int centerX = 0;
  4.             int centerY = 0;
  5.             int radius = 2;
  6.             Console.WriteLine("Coordinates of point x: ");
  7.             double x = double.Parse(Console.ReadLine());
  8.             Console.WriteLine("Coordinates of point y: ");
  9.             double y = double.Parse(Console.ReadLine());
  10.             if (Math.Pow((x - centerX), 2) + Math.Pow((y - centerY), 2) <= Math.Pow(radius, 2))
  11.             {
  12.                 Console.WriteLine(true);
  13.             }
  14.             else
  15.             {
  16.                 Console.WriteLine(false);
  17.             }          
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment