Check if given four points form a square
Submissions: 8005   Accuracy:

29.15%

  Difficulty: Basic   Marks: 1
Associated Course(s):   Interview Preparation
     

Given coordinates of four points in a plane, find if the four points form a square or not.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains 4 space separated integer points b , c , d

Output:
For each test case print 1 if the four points form a square else print 0.
Remember to output the answer of each test case in a new line.

Constraints:
1<=T<=100
1<=a,b,c,d<=100

Example:

Input
:
2
20 20 20 10 10 20 10 10
10 10 10 10 20 10 20 30

Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Joshi 1


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.