Array-promo

Question

Program to calculate the area of the rectangle.

				
					Enter a length
12
Enter a breadth
15
Area of rectangle=180.0
				
			

Share code with your friends

Share on whatsapp
Share on facebook
Share on twitter
Share on telegram

Code

				
					import java.util.Scanner;
public class areaOfrectangle
{  
    public static void main(String args[])  
    {  
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter a length");
        double len=sc.nextDouble();
        System.out.println("Enter a breadth");
        double breadth=sc.nextDouble();
        /*Formula of area of rectangle =length of rectangle *breadth of rectangle*/
        double area=len*breadth;  
        System.out.println("Area of rectangle="+area);  
     }  
}  

				
			

Coding Store

Leave a Reply

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