India's Largest Free Online Education Platform

java program to calculate the area of a rectangle

java program to calculate the area of a rectangle

Code:

import static java.lang.System.out;
public class AreaOfRectangle
{
    public static void main(String args[])
    {
        float length=5, breadth=10;
        double area = length*breadth;
        out.println("The area of the rectangle having length:"+length+ " and breadth: "+breadth+" is "+area);
    }
}

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!