Advertisement
remote87

Point inside Circle outside Rectangle

Aug 29th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Globalization;
  7.  
  8. namespace _10PointInsideCircleOutsideRectangle
  9. {
  10.     class PointInsideCircleOutsideRectangle
  11.     {
  12.         static void Main()
  13.         {
  14.             System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  15.             Console.Write("Enter a value for x: ");
  16.             double x = double.Parse(Console.ReadLine());
  17.             Console.Write("Enter a value for y: ");
  18.             double y = double.Parse(Console.ReadLine());
  19.             double radius = Math.Sqrt((x - 1) * (x - 1) + (y - 1) * (y - 1));
  20.             if (radius <= 1.5 && y > 1)
  21.             {
  22.                 Console.WriteLine("Point insid a circle and outside a rectangle: Yes");
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine("Point insid a circle and outside a rectangle: No");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement