Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. static void exerciseNumberFour()
  2. {
  3. int x1, x2, y1, y2, a1, a2, b1, b2;
  4.  
  5. Console.WriteLine("Podaj długość i szerokość prostokąta");
  6. Console.WriteLine("a1: ");
  7. a1 = Convert.ToInt32(Console.ReadLine());
  8. Console.Write("b1: ");
  9. b1 = Convert.ToInt32(Console.ReadLine());
  10.  
  11. Console.WriteLine("Podaj współprzędne wierchołka: ");
  12. Console.WriteLine("x1: ");
  13.  
  14. x1 = Convert.ToInt32(Console.ReadLine());
  15. Console.WriteLine("y1 : ");
  16.  
  17. y1 = Convert.ToInt32(Console.ReadLine());
  18.  
  19. Console.WriteLine("Podaj długość i szerokość drugiego prostokąta");
  20. Console.WriteLine("a2: ");
  21. a2 = Convert.ToInt32(Console.ReadLine());
  22. Console.Write("b2: ");
  23. b2 = Convert.ToInt32(Console.ReadLine());
  24.  
  25. Console.WriteLine("Podaj współprzędne wierchołka: ");
  26. Console.WriteLine("x2: ");
  27.  
  28. x2 = Convert.ToInt32(Console.ReadLine());
  29. Console.WriteLine("y2 : ");
  30.  
  31. y2 = Convert.ToInt32(Console.ReadLine());
  32.  
  33. if(((x1 + a1 < x2) || (y1 +b1 < y2) || (x1 > x2 + a2) || (y1 > y2 + b2)) && (0 < (a1 * b1 * a2 * b2)))
  34. {
  35. Console.WriteLine("Nie mają części wspólnych");
  36. }
  37. else
  38. {
  39. Console.WriteLine("Mają część wspólną");
  40. }
  41.  
  42. Console.ReadKey();
  43. Console.Clear();
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement