Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write an expression that checks for given point (x, y) if it is within the circle K({1, 1}, 1.5) and out of the rectangle R(top=1, left=-1, width=6, height=2).
- using System;
- class InsideOutside
- {
- static void Main()
- {
- Console.Write("Enter x: ");
- double x = double.Parse(Console.ReadLine());
- Console.Write("Enter y: ");
- double y = double.Parse(Console.ReadLine());
- double circle = ((x - 1) * (x - 1)) + ((y - 1) * (y - 1));
- if ((circle <= 2.25) && ((x > 5) || (x < -1) && (y < -1) || (y > 1)))
- {
- Console.WriteLine("yes");
- }
- else
- {
- Console.WriteLine("no");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment