Answer:
Following are the code to the given question:
#include<iostream>//header file
#include<math.h>//header file
using namespace std;
int main()//main method
{
long long x, x1, y, y1;//defining long variable
int count=0,i,j;//defining integer variable
cout<<"Enter a range for x coordinates: "<<endl;//print message
cin>>x>>x1;//input x and x1 value
cout<<"Enter a range for y coordinates: "<<endl;//print message
cin>>y>>y1; //input y and y1 value
for(i = x; i <= -x1; i++)//use nested loop that tests each coordinates
{
for(j = y; j <= y1; j++)//use nested loop that tests each coordinates
{
if(((2*pow(i,2)) + abs(2*i*j) + pow(j,2)) == 10000)//use if that checks condition as per the given question
{
cout<<"There is a planet at "<<i<<", "<<j<<endl;// print coordinates
count++;//incrementing count variable value
}
}
}
cout<<"Total number of planets detected are: "<<count<<endl;//print count value
return 0;
}
Explanation:
In this code, inside the main method long "x, x1, y, and y1" and integer "count, i, and j" type variable is declared that uses a long variable to input value from the user-end.
In the next step, two nested loops have defined that test each coordinate and define if block that checks condition as per the given question and use i, j, and count variable to print value with the message.