pupesko

SoftUni - 5.7 Point in a Circle

Oct 11th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. //Write an expression that checks if given point (x,  y) is inside a circle K({0, 0}, 2).
  2.  
  3. using System;
  4.  
  5. class PointCircle
  6. {
  7.     static void Main(string[] args)
  8.     {
  9.         Console.Write("Enter x: ");
  10.         string a = Console.ReadLine();
  11.         double pointX = double.Parse(a);
  12.  
  13.         Console.Write("Enter y: ");
  14.         string b = Console.ReadLine();
  15.         double pointY = double.Parse(b);
  16.  
  17.         double total = ((pointX * pointX) + (pointY * pointY));
  18.  
  19.         if (total <= 4)
  20.         {
  21.             Console.WriteLine("true");
  22.         }
  23.         else
  24.         {
  25.             Console.WriteLine("false");
  26.         }        
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment