Advertisement
simeon_petrov

Homework 5 Problem 7

Sep 12th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PointInACircle
  8. {
  9.     class PointInACircle
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Enter the X coordinates: ");
  14.             double x2 = double.Parse(Console.ReadLine());
  15.             Console.Write("Enter the Y coordinates: ");
  16.             double y2 = double.Parse(Console.ReadLine());
  17.             double r = 2.0;
  18.             double x1 = 0.0;
  19.             double y1 = 0.0;
  20.  
  21.             if ((Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2)) <= r * r)
  22.             {
  23.                 Console.WriteLine("true");
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine("false");
  28.             }
  29.  
  30.  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement