Java Program to Find Longest Chord of Circle When Radius is Given

bookmark

import java.io.*;
class Main
{
    public static void main(String [] args)
    {
        double R = 20;
        // formula to find longest chord of the circle
        double D =  2*R;     
        System.out.println("The longest chord of the circle is " + D);
    }
}

 


Output:

The longest chord of the circle is 40.0