Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main() //https://csharp-book.softuni.bg/chapter-08-exam-preparation.html
- {
- var first = double.Parse(Console.ReadLine());
- var second = double.Parse(Console.ReadLine());
- var point = double.Parse(Console.ReadLine());
- var left = Math.Min(first, second);
- var right = Math.Max(first, second);
- var leftDistance = Math.Abs(point - left);
- var rightDistance = Math.Abs(point - right);
- if(point<right && point > left)
- {
- Console.WriteLine("in");
- Console.WriteLine(Math.Min(leftDistance, rightDistance));
- }
- else
- {
- Console.WriteLine("out");
- Console.WriteLine(Math.Min(leftDistance, rightDistance));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement