Math, asked by saniyajabeen57, 3 days ago

Circle intersection
Margaery and Tommen were playing games outside in the castle of Red Keep and then Margaery was challenging Tommen that he cannot solve questions from Mathematics as it will be too difficult for him. Tommen wanted to prove her wrong and so he asked her to give any question and he will solve. Margaery gave a few values and asked him to tell whether the circles will intersect or not.Write a program to determine if two circles intersect each other.

Answers

Answered by patelvansh240
0

Step-by-step explanation:

uwheeuehudbd Vij are mute button to their you are mute Canvas prints are mute you are mute Canvas print a copy for I have a nice time in blanks with words the given phrases and I am having problems viewing this moment you doing granthi ring liya aaay a nice time with words the blanks you are you doing granthi ring liya aur ek y ok mam please give an update on my work and I u want a great weekend too have

Answered by qwvilla
0

Question :

Margaery and Tommen were playing games outside in the castle of Red Keep and then Margaery was challenging Tommen that he cannot solve questions from Mathematics as it will be too difficult for him. Tommen wanted to prove her wrong and so he asked her to give any question and he will solve. Margaery gave a few values and asked him to tell whether the circles will intersect or not.

Write a program to determine if two circles intersect each other.

Answer :

// JAVA CODE

import java.io.*; // package installation

class CircleIntersection

{

static int circle(int x1, int y1, int x2,int y2, int r1, int r2)

{

int distSq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);

int radSumSq = (r1 + r2) * (r1 + r2);

if (distSq == radSumSq)

if (distSq == radSumSq) return 1;

else if (distSq > radSumSq)

return -1;

}

public static void main (String[] args)

{

int x1 = -10, y1 = 8;

int x2 = 14, y2 = -24;

int r1 = 30, r2 = 10;

int t = circle(x1, y1, x2, y2, r1, r2);

if (t == 1)

System.out.println ( "Circles touch each other.");

else if (t < 0)

System.out.println ( "Circles do not touch each other.");

else

System.out.println ( "Circles intersect each other.");

}

}

#SPJ3

Similar questions