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:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.