Spocoman

08. Point on Rectangle Border

Nov 18th, 2021 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PointOnRectangleBorder
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  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.             double x = double.Parse(Console.ReadLine());
  14.             double y = double.Parse(Console.ReadLine());
  15.             bool firstCondition = (x == x1 || x == x2) && (y >= y1 && y <= y2);
  16.             bool secondCondition = (y == y1 || y == y2) && (x >= x1 && x <= x2);
  17.  
  18.             if (firstCondition || secondCondition)
  19.             {
  20.                 Console.WriteLine("Border");
  21.             }
  22.             else
  23.             {
  24.                 Console.WriteLine("Inside / Outside");
  25.             }
  26.         }
  27.     }
  28. }
  29.    
Add Comment
Please, Sign In to add comment