Advertisement
Spocoman

Point Of Segment(Ternary Operator)

Oct 1st, 2023
1,176
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 1 0
  1. using System;
  2.  
  3. namespace PointOfSegment
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int first = int.Parse(Console.ReadLine());
  10.             int second = int.Parse(Console.ReadLine());
  11.             int point = int.Parse(Console.ReadLine());
  12.  
  13.             Console.WriteLine(point <= first && point >= second || point >= first && point <= second ? "in" : "out");
  14.             Console.WriteLine(Math.Min(Math.Abs(first - point), Math.Abs(second - point)));
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement