Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class PointInACircle
- {
- public static void Main()
- {
- Console.Write("Please input coordinates for x. x ="); // Here we ask for x coordinates
- double x = double.Parse(Console.ReadLine());
- Console.Write("Please input coordinates for y. y ="); // Here we ask for y coordinates
- double y = double.Parse(Console.ReadLine());
- Console.Write("Please input radius R. R =");// Here we ask for radius
- double R = double.Parse(Console.ReadLine());
- bool isInside = (x * x) + (y * y) <= (R*R); //Here we check is this point in the circle. If circle radius is different than 0,0 you should use (x-value of center ) and (y-value of center)
- Console.WriteLine("Are these coordinates in the circle? This is " + isInside + "!"); //Finally print it
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement