Java Program || Write a Java program to enter length and breadth of a rectangle and find its area.||BCA Sem- 4
Java Program
Static Program :-
class arectangle
{
public static void main(String args[])
{
int length = 10,width=20,area;
area = length * width;
System.out.println("The area of rectangle is :-"+area);
}
}
Output :-
Dynamic :-
import java.util.*;
class arectangle
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the length :- ");
int length = in.nextInt();
System.out.println("Enter the Width :- ");
int width = in.nextInt();
int area = length * width;
System.out.println("The area of Rectangle is :- "+area);
}
}
Output :-