write a Java program to input Length and Breadth of a rectangte to print Area and Perimeter.
Answers
Answered by
0
Answer:
answer in attachment
Explanation:
please mark as brainlist
Attachments:
Answered by
2
import java.util.Scanner;
public class RectInfo {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
double length = sc.nextDouble();
double breadth = sc.nextDouble();
System.out.println("Area of the rectangle is - " + length * breadth);
System.out.println("Perimeter of the rectangle is - " + 2 * (length + breadth));
}
}
-----------------------------
- We imported Scanner class for taking input from the user.
- We declared class name as "RectInfo".
- Then there is main method.
- We activated the scanner.
- We took input in two variables as length and breadth respectively.
- We printed them using the println() method.
- And finished it...
Hope it helps...
Similar questions