Advertisement
diyanborisov

InsideCircleOutsideRectangle

Dec 8th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. class PointInsideCircleOutsideRectangle
  9. {
  10.     static void Main()
  11.     {
  12.  
  13.  
  14.         double x = double.Parse(Console.ReadLine());
  15.         double y = double.Parse(Console.ReadLine());
  16.         double radius = 1.5;
  17.         if ((x - 1) * (x - 1) + (y - 1) * (y - 1) <= Math.Pow(radius, 2))
  18.         {
  19.             if (y > 1 && (x > -0.5 && x < 2.5))
  20.             {
  21.                 Console.WriteLine("The point is IN the circle and OUT of the rectangle. -   YES   -");
  22.             }
  23.             else
  24.             {
  25.                 Console.WriteLine("The point is IN the circle, but also IN the rectangle. -   NO   -");
  26.             }
  27.  
  28.         }
  29.         else
  30.         {
  31.             Console.WriteLine("The point is OUT of circle and OUT of rectangle. -   NO   -");
  32.         }
  33.  
  34.  
  35.  
  36.  
  37.     }
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement