Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Write an expression that checks if given point (x, y) is inside a circle K({0, 0}, 2).
- namespace _07.PointInACircle
- {
- using System;
- public class PointInACircle
- {
- private const double Radius = 2d;
- public static void Main(string[] args)
- {
- checked
- {
- Console.Write("Enter value of coordinate X of given point: ");
- double pointX = double.Parse(Console.ReadLine());
- Console.Write("Enter value of coordinate Y of given point: ");
- double pointY = double.Parse(Console.ReadLine());
- bool pointIsInTheCircle = true;
- double temp = Math.Sqrt((pointX * pointX) + (pointY * pointY));
- if (temp > Radius)
- {
- pointIsInTheCircle = false;
- }
- Console.WriteLine("Given point is In the Circle: {0} !", pointIsInTheCircle);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement