anizko

01. Point on Rectangle Border

Apr 1st, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Nested_Conditional_Statements___Exercise
  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.  
  16.  
  17.             if ((x==x1||x==x2)&&(y>=y1&&y<=y2)|| (x >= x1 && x <= x2) && (y == y1 || y == y2)  )
  18.             {
  19.                 Console.WriteLine("Border");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine("Inside / Outside");
  24.             }
  25.  
  26.  
  27.  
  28.  
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment