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;
- using System.Globalization;
- namespace _07PointInACircle
- {
- class PointInACircle
- {
- static void Main()
- {
- System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- do
- {
- Console.Write("Enter a value for x: ");
- float x = float.Parse(Console.ReadLine());
- Console.Write("Enter a value for y: ");
- float y = float.Parse(Console.ReadLine());
- float r = 2;
- if (((x * x) + (y * y)) == r * r)
- {
- Console.WriteLine("The point is on the circle.");
- }
- else if (((x * x) + (y * y)) < r * r)
- {
- Console.WriteLine("The point is inside the circle.");
- }
- else if (((x * x) + (y * y)) > r * r)
- {
- Console.WriteLine("The point is outside the circle.");
- }
- else
- {
- Console.WriteLine("Wrong coordinates.");
- }
- Console.Write("Do you want to continiue? (Y/N): ");
- } while (Console.ReadLine().ToUpper() == "Y");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement