Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PointOnSegment
- {
- class Program
- {
- static void Main(string[] args)
- {
- int firstNumber = int.Parse(Console.ReadLine());
- int secondNumber = int.Parse(Console.ReadLine());
- int firstPoint = 0;
- int secondPoint = 0;
- if (firstNumber > secondNumber)
- {
- secondPoint = firstNumber;
- firstPoint = secondNumber;
- }
- else
- {
- secondPoint = secondNumber;
- firstPoint = firstNumber;
- }
- int point = int.Parse(Console.ReadLine());
- int CheckNum = firstPoint - point < secondPoint - point ? firstPoint : secondPoint;
- if (point >= firstPoint && point <= secondPoint)
- {
- Console.WriteLine("in");
- }
- else
- {
- Console.WriteLine("out");
- }
- if (point >= secondPoint)
- {
- Console.WriteLine(Math.Abs(point - secondPoint));
- }
- else if (point <= firstPoint)
- {
- Console.WriteLine(Math.Abs(firstPoint - point));
- }
- else
- {
- Console.WriteLine(Math.Abs(CheckNum - point));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement