Advertisement
Guest User

point in the figure

a guest
Jul 8th, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. int h = int.Parse(Console.ReadLine());
  9. int x = int.Parse(Console.ReadLine());
  10. int y = int.Parse(Console.ReadLine());
  11.  
  12. //check if the point is inside the figure
  13.  
  14. if ((x>h&&x<2*h&&y>h&&y<4*h) || (x>0&&x<3*h&&y>0&&y<h)||(y==h&&x>h&&x<2*h))
  15. {
  16. Console.WriteLine("inside");
  17. }
  18.  
  19. //check if the point is on the border
  20. else if ((x>=h&&x<=2*h&&y==4*h)||((y>=h&&y<=4*h)&&(x==h||x==2*h))||((x>=0&&x<=3*h))&&(y==0||y==h)||(y>=0&&y<=h)&&(x==0||x==3*h))
  21. {
  22. Console.WriteLine("border");
  23. }
  24. //if not inside or a border, it's outside:
  25. else
  26. {
  27. Console.WriteLine("outside");
  28. }
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement