Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("Enter the Radius and the coordinates(x,y) :");
- double R = Convert.ToDouble(Console.ReadLine());
- double X;
- double Y;
- for (int i = 0; i < 10; i++)
- {
- X = Convert.ToDouble(Console.ReadLine());
- Y = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("#################################");
- 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))
- Console.WriteLine("You hit the target!");
- else Console.WriteLine("You do not hit the target :(");
- Console.WriteLine("#################################");
- }
- Console.WriteLine("You have run out of ammo, start over.");
- Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment