Wap in java to calculate area of a side , perimeter of a side
Answers
Answered by
1
public class RectangleAreaPerimeter {
public static void main(String args[]) {
int length, width, area, perimeter;
Scanner in = new Scanner(System.in);
System.out.println("Enter length of Rectangle");
length = in.nextInt();
System.out.println("Enter width of Rectangle");
width = in.nextInt();
// Area of rectangle = length X width
area = length*width;
// Perimeter of rectangle = 2 X (length X width)
perimeter = 2*(length + width);
System.out.println("Area of Rectangle : "+ area);
System.out.println("Rectangle of Rectangle : "+ perimeter);
}
}
OutputEnter length of Rectangle 4 Enter width of Rectangle 5 Area of Rectangle : 20 Rectangle of Rectangle : 18
nitish8089:
import statement ;)
Similar questions