Advertisement
tockata

Operators and Expressions - Problem 9.

Mar 19th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.     class Program
  5.     {
  6.         static void Main()
  7.         {
  8.             Console.Write("Enter x: ");
  9.             decimal x = decimal.Parse(Console.ReadLine());
  10.             Console.Write("Enter y: ");
  11.             decimal y = decimal.Parse(Console.ReadLine());
  12.             bool checktcircle = (((x-1) * (x-1) + (y-1) * (y-1))<9);
  13.             bool checktrectangle = ((y > 1) || (y < (-1))) || (((y<1 ||y>(-1)) && (x<(-1))));
  14.             if (checktcircle && checktrectangle)
  15.             {
  16.                 Console.WriteLine("The point is in the circle and outside the rectangle.");
  17.             }
  18.             else
  19.             {
  20.                 Console.WriteLine("The point is NOT in the circle and outside rectnagle at the same time.");
  21.             }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement