Diagonal of a rectangle || Geometric program || Java programs || Java
In this, we are going to see the program to find Length of a Diagonal of a Rectangle in Java.

import java.util.*;

class demo 
{
    public static void main(String[] args) 
    {
        Scanner sc = new Scanner(System.in);
        double l, b, d;
        System.out.println("Enter the length and breadth of the rectangle:");
        l = sc.nextDouble();
        b = sc.nextDouble();
        d = Math.sqrt(l * l + b * b);
        System.out.println("Diagonal= " + d);
    }
}
#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post