Array-promo

Question

Program to calculate the perimeter of the rectangle.

Share code with your friends

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

Code

				
					import java.util.Scanner;
public class perimeterOfrectangle
{  
    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 perimeter of rectangle =2*(length of rectangle +breadth of rectangle)*/
        double perimeter=2*(len+breadth);  
        System.out.println("perimeter of rectangle="+perimeter);  
     }  
}  

				
			

Coding Store

Leave a Reply

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