WAP to find area of rectangle using scanner.

1 year ago
OOP Java

Compile code:

import java.util.Scanner;
public class Areaofrectangle{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter a length: ");
int l=sc.nextInt();
System.out.println("Enter a breadth: ");
int b=sc.nextInt();
sc.close();
int area=l*b;
System.out.println("Area of rectangle is: "+area);

}
}

 

Output:

0
Dipti KC
Jan 8, 2023
More related questions

Questions Bank

View all Questions