saimun1

[EXAM PREP] Tочка във фигура

Jul 24th, 2017
83
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace test
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //https://csharp-book.softuni.bg/chapter-08-exam-preparation.html
  14.             int x = int.Parse(Console.ReadLine());
  15.             int y = int.Parse(Console.ReadLine());
  16.             bool pointInRect1 = x >= 4 && x <= 10 && y >= -5 && y <= 3;
  17.             bool pointInRect2 = x >= 2 && x <= 12 && y >= -3 && y <= 1;
  18.             if (pointInRect1 || pointInRect2)
  19.             {
  20.                 Console.WriteLine("in");
  21.             }
  22.             else
  23.             {
  24.                 Console.WriteLine("out");
  25.  
  26.             }
  27.             Console.ReadLine();
  28.  
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment