Advertisement
Fundamentalen

CircleAndRectangle

Mar 14th, 2014
1,610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. class CircleAndRectangle
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("x = ");
  8.         double x = double.Parse(Console.ReadLine());
  9.         Console.Write("y = ");
  10.         double y = double.Parse(Console.ReadLine());
  11.  
  12.         bool isInCircle = (x - 1) * (x - 1) + (y - 1) * (y - 1) <= (1.5 * 1.5);
  13.         bool isOutsideRectangle = x > 1 || x < 6 && y > -1 || y < 2;
  14.  
  15.         if (x == 0 || y == 0)
  16.         {
  17.             Console.WriteLine("no");
  18.         }
  19.         else if (isInCircle == true && isOutsideRectangle == true)
  20.         {
  21.             Console.WriteLine("yes");
  22.         }
  23.         else
  24.         {
  25.             Console.WriteLine("no");
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement