Advertisement
VyaraG

PointInaCircleOutRect

Nov 28th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. class PointInaCircleOutRect
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write ("Enter the 'x' value of the point: ");
  8.         double xOfThePoint = double.Parse(Console.ReadLine());
  9.         Console.Write("Enter the 'y' value of the point: ");
  10.         double yOfThePoint = double.Parse(Console.ReadLine());
  11.  
  12.         bool isInsideaCircle = (((Math.Pow(xOfThePoint - 1,2)) + (Math.Pow(yOfThePoint - 1,2))<= 1.5*1.5));
  13.         bool isInARectangle = ((xOfThePoint <= 5 && xOfThePoint >= -1) && (yOfThePoint >= -1 && yOfThePoint <= 1));
  14.         if (isInsideaCircle && !isInARectangle)
  15.         {
  16.             Console.WriteLine("Yes");  
  17.         }
  18.         else
  19.         {
  20.             Console.WriteLine("No");
  21.         }
  22.        
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement