Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PointInsideACircleOutsideOfARectangle
- {
- class PointInsideACircleAndOutsideOfARectangle
- {
- static void Main()
- {
- double xPoint = double.Parse(Console.ReadLine());
- double yPoint = double.Parse(Console.ReadLine());
- double xCirclePoint = 0;
- double yCirclePoint = 0;
- double radius = 5.0D;
- double areInside = Math.Pow(( xPoint - xCirclePoint ) , 2) + Math.Pow(( yPoint - yCirclePoint ) , 2);
- bool insideCircle = areInside <= Math.Pow(radius , 2);
- bool insideRectangle = ( xPoint >= -1 && xPoint <= 5 ) && ( yPoint >= -1 && yPoint <= 5 );
- if(insideCircle && insideRectangle == false)
- {
- Console.WriteLine("The point is within the circle and out of the rectangle ");
- }
- else
- {
- Console.WriteLine(false);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement