Advertisement
rosenrusev

Problem 10-PointsInsideInACircleAndOfARectangle

Mar 13th, 2014
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace PointsInsideInACircleAndOfARectangle
  7. {
  8. class PointsInsideInACircleAndOfARectangle
  9. {
  10. static void Main()
  11. {
  12. Console.Write("X coordinate: ");
  13. double x = double.Parse(Console.ReadLine());
  14.  
  15. Console.Write("Y coordinate: ");
  16. double y = double.Parse(Console.ReadLine());
  17. Console.WriteLine();
  18.  
  19. bool result = (((x - 1) * (x - 1) + (y - 1) * (y - 1)) <= 2.25) && ((x <= 5) || ((x >= -1) && ((y <= -1) || (y >= 1))));
  20. Console.WriteLine("The coordinates are inside the circle and out of the rectangular: {0}", result);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement