- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java program to find the area of a rectangle
Area of a rectangle is the product of its length and breadth. Therefore, to calculate the area of a rectangle
- Get the length of the rectangle form the user.
- Get the breadth of the rectangle form the user.
- Calculate their product.
- Print the product.
Example
import java.util.Scanner; public class AreaOfRectangle { public static void main(String args[]){ int length, breadth, area; Scanner sc = new Scanner(System.in); System.out.println("Enter the length of the rectangle ::"); length = sc.nextInt(); System.out.println("Enter the breadth of the rectangle ::"); breadth = sc.nextInt(); area = length* breadth; System.out.println("Area of the rectangle is ::"+area); } }
Output
Enter the length of the rectangle :: 56 Enter the breadth of the rectangle :: 48 Area of the rectangle is ::2688
- Related Articles
- Golang program to find the area of a rectangle
- Haskell Program to Find the Area of a Rectangle
- Swift Program to find the area of the rectangle
- Python Program to Find the Area of a Rectangle Using Classes
- Golang Program to Find the Area of a Rectangle Using Classes
- Java Program to Find the Perimeter of a Rectangle
- JavaScript program to find Area and Perimeter of Rectangle
- Java program to find the area of a square
- Java program to find the area of a triangle
- Java program to find the area of a circle
- Java Program to Find the Area of a Trapezium
- Java Program to Find the Area of a Parallelogram
- Program to find largest rectangle area under histogram in python
- Java Program to Find Area of Square
- Find the Area of a Circle in Java Program

Advertisements