Write a program in Java to find the area and perimeter of rectangle and square..
Answers
Answer:
Java Program to Create a Simple Class to Find out the Area and Perimeter of Rectangle
public class Area_Perimeter.
int l, b, perimeter, area;
Scanner s = new Scanner(System.
System. out. print("Enter length of rectangle:");
l = s. nextInt();
System. out. ...
b = s. nextInt();
perimeter = 2 * (l + b);
Explanation:
have a nice day
Answer:
Write a Java program to input length and width and find perimeter and area of rectangle. Logic to find perimeter and area of a rectangle, whose length and width are given. In this example we will learn to write basic logical program in Java. We will learn to find perimeter and area of rectangle.
Example
Input
Length of rectangle = 30
Width of rectangle = 20
Output
Perimeter of rectangle is 100.0 units.
Area of rectangle is 600.0 sq. units.