Write a C program that: Thanks! Complete the C program below by adding a functio
ID: 3673266 • Letter: W
Question
Write a C program that:
Thanks!
Complete the C program below by adding a function called intersect so that the program will determine if two circles intersect. The first circle has centre (px,py) with radix pr and the second circle has centre (qx,qy) with radix qr. Note that two circles intersect if they share a common area This skeleton program is available in the Assignment 4 section on the conneX page in a file a4p2start.c. Use your own test data and make sure you check a reasonable number of cases including circles that intersect and do not intersect. Make sure touching circles are handled properly (they do not intersect). #include #include #include //Put your function intersect here. int main () { double px,py,pr,qx,qy,qr; setvbuf(stdout, NULL, _IONBF, 0); while(1){ printf("radix 1: "); scanf("%lf",≺); if(prExplanation / Answer
int intersect(int px, int py, int pr, int qx, int qy, int qr){
(R0-R1)^2 <= (x0-x1)^2+(y0-y1)^2 <= (R0+R1)^2
int d = (px - qx)*(px - qx) + (py - qy)*(py-qy);
if( (d <= (pr+qr)*(pr+qr)) && (d >= (pr-qr)*(pr-qr))))
return 1;
return 0;
}