Advertisement
Spocoman

08. Point on Rectangle Border

Sep 19th, 2024
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.49 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var x1, y1, x2, y2, x, y float64
  6.     fmt.Scanln(&x1)
  7.     fmt.Scanln(&y1)
  8.     fmt.Scanln(&x2)
  9.     fmt.Scanln(&y2)
  10.     fmt.Scanln(&x)
  11.     fmt.Scanln(&y)
  12.    
  13.     var firstCondition = (x == x1 || x == x2) && (y >= y1 && y <= y2)
  14.     var secondCondition = (y == y1 || y == y2) && (x >= x1 && x <= x2)
  15.    
  16.     if(firstCondition || secondCondition){
  17.         fmt.Println("Border")
  18.     } else {
  19.         fmt.Println("Inside / Outside")
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement