Area of rectangle program in java

Given the length and breadth of a rectangle, print area of the rectangle.

Input Format

First and only line of input contains two positive integers L – length of the rectangle and B – breadth of the rectangle.

Constraints

1 <= L, B <=109

Output Format

Print area of the given rectangle.

InputcopyOutputcopy
5 840

Explanation:

Self Explanatory

Solution:

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long length = sc.nextInt();
        long width = sc.nextInt();
        long area = length * width;
        System.out.println(area);
    }
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top