Computer Science, asked by animal235, 9 months ago

Write a program in java to enter the sides of a rectangle and to calculate its area and perimeter.

Answers

Answered by Anonymous
2

Question

Write a program in java to enter the sides of a rectangle and to calculate its area and perimeter.

Answer:

import java.util.*;

public class Scanner

{

Scanner in =new Scanner(System.in);

float a,p,l,b;

System.out.println("Enter the length of the rectangle");

l=in.nextFloat();

System.out.println("Enter the breadth of the rectangle");

b=in.nextFloat();

a=(l*b);

System.out.println("The area of the rectangle is="+a);

p=2*(l+b);

System.out.println("The perimeter of the rectangle is="+p);

}

}

For more java programmings follow the given links as I have solved earlier:

brainly.in/question/14797688

brainly.in/question/16088835

https://brainly.in/question/16166891

Similar questions