Advertisement
Guest User

r

a guest
Oct 29th, 2018
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Point_in_Rectangle
  4. {
  5.    public class Program
  6.     {
  7.        public static void Main()
  8.         {
  9.             double x1 = double.Parse(Console.ReadLine());
  10.             double y1 = double.Parse(Console.ReadLine());
  11.             double x2 = double.Parse(Console.ReadLine());
  12.             double y2 = double.Parse(Console.ReadLine());
  13.  
  14.             double x = double.Parse(Console.ReadLine());
  15.             double y = double.Parse(Console.ReadLine());
  16.  
  17.             bool isAsideFromLeft = x >= x1;
  18.             bool isAsideFromRight = x <= x2;
  19.  
  20.             bool isAsideFromTop = y >= y1;
  21.             bool isAsideFromBottom = y <= y2;
  22.  
  23.             if ((x == x1 || x == x2) && isAsideFromTop && isAsideFromBottom || (y == y1 || y == y2) && isAsideFromLeft && isAsideFromRight)
  24.             {
  25.                 Console.WriteLine("Border");
  26.             }
  27.  
  28.             else Console.WriteLine("Inside / Outside");
  29.  
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement