Akioni

dddd

Oct 15th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. Console.WriteLine("Enter the Radius and the coordinates(x,y) :");
  2.            
  3.             double R = Convert.ToDouble(Console.ReadLine());
  4.             double X;
  5.             double Y;
  6.  
  7.             for (int i = 0; i < 10; i++)
  8.             {
  9.  
  10.                 X = Convert.ToDouble(Console.ReadLine());
  11.                 Y = Convert.ToDouble(Console.ReadLine());
  12.  
  13.                 Console.WriteLine("#################################");
  14.  
  15.                 if ((X < 0 && Y < 0 && X > (-R) && Y > (-R) && Math.Pow((X + R), 2) + Math.Pow((Y - R), 2) > R * R) || (X > 0 && Y > 0 && Math.Pow((X - R), 2) + Y * Y < R * R))
  16.  
  17.                     Console.WriteLine("You hit the target!");
  18.                 else Console.WriteLine("You do not hit the target :(");
  19.  
  20.                 Console.WriteLine("#################################");
  21.             }
  22.             Console.WriteLine("You have run out of ammo, start over.");
  23.             Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment