WAP to find area of rectangle using scanner.
3 years 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:

Dipti KC
Jan 8, 2023