Java Program to Find the Side of the Squares which are Inclined Diagonally and Lined in a Row

bookmark

import java.io.*;
class Main
{
    public static void main(String [] args)
    {
        int n = 6;
        double d = 25;
        // formula to find length of each square
        double a =  d/((n-1)*(Math.sqrt(2)));     
        System.out.println("The length of each square is " + a);
    }
}


Output:

The length of each square is 3.5355339059327373