Answers for "Write a java program to print the length and perimeter of a rectangle"

0

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

import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
int length, breadth, peri, area;
Scanner scan = new Scanner(System.in);
System.out.print("Enter length and breadth of Rectangle ");
length = scan.nextInt();
breadth = scan.nextInt();
area = length*breadth;
peri = (2*length) + (2*breadth);
System.out.print("Area = " +area);
System.out.print("\nPerimeter = " +peri);
}
}
Posted by: Guest on July-04-2021

Code answers related to "Write a java program to print the length and perimeter of a rectangle"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language