Computer Science, asked by zainab2620, 2 months ago

Write a program in Java to find the area of rectangle where length=4.4 and width=5.5. (Area

of Rectangle = l*b).
answer ​

Answers

Answered by atrs7391
3

public class Main{  

   public static void main(String args[])  

   {  

   float l=4.4;  

   float b=5.5;    

   System.out.println("Area of rectangle="+l*b);  

    }  

}  

Answered by anindyaadhikari13
2

Required Answer:-

Question:

  • Write a program in Java to find the area of the rectangle whose length = 4.4 and width=5.5.

Solution:

Here comes the program.

  1. public class Area {
  2.  public static void main(String[] args) {
  3.      float l=4.4f, w=5.5f, a=l*w;
  4.      System.out.println("Length: "+l);
  5.      System.out.println("Width:  "+w);
  6.      System.out.println("Area: "+a);
  7.  }
  8. }

Explanation:

  • Line 1: Creates the area class.
  • Line 2: Contains main() method. It is the starting point of the execution of the program.
  • Line 3: Declares the length, breadth and area. Area is calculated by formula, a = lb.
  • Line 4: Length is displayed.
  • Line 5: Breadth is displayed.
  • Line 6: Area is displayed.
  • Line 7: End of main().
  • Line 8: End of class.

Refer to the attachment for output ☑.

Attachments:
Similar questions