Write a program to input the length and breadth of a rectangle and find its area and perimeter
Answers
Answer:
Scanner sc = new scanner (system. In) ; float length, breath, area, perimeter;
System.out.put.in ("enter length and breath of a ractangle")
Length = sc. Nextfloat();
Breath = sc. Nextfloat () ;
Area = Length × breath ;
Perimeter = 2( length + breath) ;
System.out.printin.("area" +area) ;
System.out.printin. ("perimeter" +perimeter) ;
Explanation:
I hope it is help full for you.
Program: {JAVA}
import java.util.*;
public class Brainly
{
static void main()
{
Scanner sc=new Scanner(System.in);
float length,breadth,area,perimeter;
System.out.println("Enter length and breadth of a rectangle:");
length=sc.nextFloat();
breadth=sc.nextFloat();
area=length*breadth;
perimeter=2*(length+breadth);
System.out.println("Area="+area);
System.out.println("Perimeter="+perimeter);
}
}