Problem: Find Point

Problem statement

Given two points P and Q, output the symmetric point of point P about Q.

Input format:
First line contains an integer T representing the number of testcases (T <= 15)
Each test case contains Px Py Qx Qy representing the (x,y) coordinates of P and Q, all of them being integers

Constraints
1 <= T <= 15
-100 <= x, y <= 100

Output format
For each test case output x and y coordinates of the symmetric point

Sample input

``````1
0 0 1 1
``````

Sample output

``````2 2
``````

This challenge was a part of Pragyan 12

This is my code:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

struct Node{
int x1,x2,y1,y2;
};

struct Node a[100];

int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int T,i;
scanf(“%d”,&T);
for(i=0;i<T;++i)
scanf(“%d%d%d%d”,&a[i].x1,&a[i].y1,&a[i].x2,&a[i].y2);
for(i=0;i<T;++i){
printf(“%d %d”,2*a[i].x2 – a[i].x1, 2*a[i].y2 – a[i].y1);
if(i!=T-1)
printf(“\n”);
}
return 0;
}