Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Point_over_segment
- {
- class Program
- {
- static void Main(string[] args)
- {
- int first = int.Parse(Console.ReadLine());
- int second = int.Parse(Console.ReadLine());
- int point = int.Parse(Console.ReadLine());
- if (point < first && point > second)
- {
- Console.WriteLine("in");
- Console.WriteLine(Math.Min(Math.Abs(first - point), Math.Abs(second - point)));
- }
- else if (point == first || point == second)
- {
- Console.WriteLine("in");
- Console.WriteLine(0);
- }
- else if(point<first&&point<second&&first>second)
- {
- Console.WriteLine("out");
- Console.WriteLine(Math.Abs(second-point));
- }
- else if (point < first && point < second && first < second)
- {
- Console.WriteLine("out");
- Console.WriteLine(Math.Abs(first - point));
- }
- else if (point < first && point < second && first > second)
- {
- Console.WriteLine("out");
- Console.WriteLine(Math.Abs(second - point));
- }
- else if (point > first && point > second && first > second)
- {
- Console.WriteLine("out");
- Console.WriteLine(Math.Abs(point-first));
- }
- else if (point > first && point > second && first < second)
- {
- Console.WriteLine("out");
- Console.WriteLine(Math.Abs(point - second));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement