Print area of a rectangle in Java
Java Output - Question 15
In this question, we will see how to print the area of a rectangle in java programming using the java output. To know more about java output click on the java output lesson.
Q15) Write a program in java to find the area of a rectangle if length is 10 and breadth is 5.
Formula: area = length * breadth
Program
public class Q15
{
public static void main(String args[])
{
System.out.println("Length=10");
System.out.println("Breadth=5");
System.out.print("Area=" + (10*5));
}
}
Output
Length=10 Breadth=5 Area=50