Write a java program to find the area of the rectangle.
Program Code in JAVA:
class AreaRect
{
public static void main(String args[])
{
int len,bre,area;
len= Integer.parseInt(args[0]);
bre=Integer.parseInt(args[1]);
area=len*bre;
system.out.println(“length of rectangle=”+len);
system.out.println(“breadth of rectangle=”+bre);
system.out.println(“area of rectangle=”+area);
}
}
Program Output:
c:\java>javac AreaRect.java
c:\java>java AreaRect
12 6
length of rectangle = 12
breadth of rectangle = 6
area of rectangle= 72
Post A Comment:
0 comments: