NadyaMisheva

java book 8.1.

Nov 23rd, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int first= int.Parse(Console.ReadLine());
  8.         int second= int.Parse(Console.ReadLine());
  9.         int point= int.Parse(Console.ReadLine());
  10.         int left = Math.Min(first, second);
  11.         int right = Math.Max(first, second);
  12.         if (point >= left && point <= right)
  13.         {
  14.             Console.WriteLine("in");
  15.         }
  16.         else
  17.         {
  18.             Console.WriteLine("out");
  19.         }
  20.         int d = Math.Min(Math.Abs(left - point), Math.Abs( right - point));
  21.         Console.WriteLine(d);
  22.     }
  23. }
Add Comment
Please, Sign In to add comment