Here is the code of the program:import java.io.*;
class RecArea
{
public static void main(String[] args)
{
int l=0;
int w=0;
try{
BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter length of rectangle : ");
l = Integer.parseInt(br1.readLine());
System.out.println("Enter width of rectangle : ");
w = Integer.parseInt(br1.readLine());
int area = l*w;
System.out.println("Area of Rectangle : "+area);
int perimiter = 2*(l+w);
System.out.println("Perimeter: " + perimiter);
}catch(Exception e){System.out.println("Error : "+e);}
}
}
Download this example.
No comments:
Post a Comment