write a java program to print the length and perimeter of a rectangle

Solutions on MaxInterview for write a java program to print the length and perimeter of a rectangle by the best coders in the world

showing results for - "write a java program to print the length and perimeter of a rectangle"
Noelie
11 Feb 2016
1import java.util.Scanner;
2public class Main
3{
4public static void main(String args[])
5{
6int length, breadth, peri, area;
7Scanner scan = new Scanner(System.in);
8System.out.print("Enter length and breadth of Rectangle ");
9length = scan.nextInt();
10breadth = scan.nextInt();
11area = length*breadth;
12peri = (2*length) + (2*breadth);
13System.out.print("Area = " +area);
14System.out.print("\nPerimeter = " +peri);
15}
16}