Advertisement
Spocoman

Point Of Segment

Oct 12th, 2024
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.44 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "math"
  6. )
  7.  
  8. func main() {
  9.     var first, second, point int
  10.     fmt.Scanln(&first)
  11.     fmt.Scanln(&second)
  12.     fmt.Scanln(&point)
  13.    
  14.     if point <= first && point >= second || point >= first && point <= second {
  15.         fmt.Println("in")
  16.     } else {
  17.         fmt.Println("out")
  18.     }
  19.     fmt.Println(math.Min(math.Abs(float64(first) - float64(point)), math.Abs(float64(second) - float64(point))))
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement