Java Program to Find Center of the Circle Using Endpoints of Diameter

bookmark

import java.io.*;
class Main
{
    public static void main(String [] args)
    {
        int x1 = 1;
        int y1 = 2;
        int x2 = 3;
        int y2 = 4;
        int c1 = (x1+x2)/2 ; 
        int c2 = (y1+y2)/2; 
        System.out.println("The center of the  circle is " + c1 + "," + c2);
    }
}

 


Output:

The center of the circle is 2,3