There are two circles C1 with radius r1, central coordinate (x1, y1) and C2 with radius r2 and central coordinate (x2, y2) Write a PHP program to test the followings -
- برمجة بي اتش بي
- 2021-09-08
- mhanasmh00489829403
الأجوبة
<?php
$n = intval(fgets(STDIN));
for($i = 0; $i < $n; $i++){
fscanf(STDIN, "%lf %lf %lf %lf %lf %lf", $xa, $ya, $ra, $xb, $yb, $rb);
$r = sqrt(($xb - $xa)*($xb - $xa) + ($yb - $ya)*($yb - $ya));
if($r + $ra < $rb){
echo "C1 is in C2\n";
continue;
}
if($r + $rb < $ra){
echo "C2 is in C1.\n";
continue;
}
if($r <= $ra + $rb){
echo "Circumference of C1 and C2 intersect.";
continue;
}
echo "C1 and C2 do not overlap.\n";
}
?>
Sample Input:
2
0.0 0.0 6.0 0.0 0.0 5.0
0.0 0.0 3.0 5.1 0.0 3.0
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال