Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Globalization;
  6.  
  7. namespace Test11
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  14.  
  15.             bool isRunning = true;
  16.             int radius = 2;
  17.             double radiusPow = Math.Pow(radius, 2);
  18.  
  19.             while (isRunning)
  20.             {
  21.                 Console.WriteLine("Enter X:");
  22.                 int X = int.Parse(Console.ReadLine());
  23.                 Console.WriteLine("Enter Y:");
  24.                 int Y = int.Parse(Console.ReadLine());
  25.  
  26.                 double point = Math.Pow(X, 2) + Math.Pow(Y, 2);
  27.  
  28.                 Console.WriteLine(point == radiusPow ? "The point is on the circle." : (point < radiusPow ? "The point is inside the circle." : "The point is outside the circle."));
  29.  
  30.                 ConsoleKeyInfo toBeContinued = Console.ReadKey();
  31.                 Console.WriteLine();
  32.                 if (toBeContinued.KeyChar == 'N' || toBeContinued.KeyChar == 'n')
  33.                 {
  34.                     isRunning = false;
  35.                 }
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement