Java Program to find Area and Perimeter of a Rectangle

import java.util.*;
class scan
{
 public static void main(String arg[])
  {
	  int x,y,z1,z2;
	   Scanner kb=new Scanner(System.in);
     System.out.println("Enter height:-");
	 x=kb.nextInt();
	 System.out.println("Enter width:-");
	 y=kb.nextInt();
	 z1=x*y;
	 z2=2*(x+y);
	 System.out.println("Area of rectangle is: "+z1);
	 System.out.println("Perimeter of rectangle is: "+z2);
  }
}

OUTPUT:-

Leave a Reply

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