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_on_Segment_Loop
- {
- class Program
- {
- static void Main(string[] args)
- {
- var first = int.Parse(Console.ReadLine());
- var second = int.Parse(Console.ReadLine());
- var point = int.Parse(Console.ReadLine());
- var minNum = Math.Min(first, second);
- var maxNum = Math.Max(first, second);
- bool pointIsIn = false;
- for (int i = minNum; i <= maxNum; i++)
- {
- if (point == i)
- {
- pointIsIn = true;
- break;
- }
- }
- if (pointIsIn)
- {
- Console.WriteLine("in");
- }
- else
- {
- Console.WriteLine("out");
- }
- var difference = Math.Min(Math.Abs(point - first), Math.Abs(point - second));
- Console.WriteLine(difference);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement