You are here: Home / Topics / Java Program to find area of rectangle

Java Program to find area of rectangle

Filed under: Java on 2024-03-05 21:40:08

import java.util.Scanner;
class AreaOfRectangle 
{
  public static void main(String args[]) 
   {   
      
     Scanner s= new Scanner(System.in);
       
       System.out.println("Enter the length:");
       double l= s.nextDouble();
       System.out.println("Enter the width:");
       double b= s.nextDouble();                       
         
       double  area=l*b;
     System.out.println("Area of Rectangle is: " + area);      
  }
}

 

Output:

Enter the length:

10

Enter the width:

10

Area of Rectangle is: 100


About Author:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.