- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- 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 triangle

Area of a triangle is half the product of its base and height. Therefore, to calculate the area of a triangle.

- Get the height of the triangle form the user.
- Get the base of the triangle form the user.
- Calculate their product and divide the result with 2.
- Print the final result.

## Example

import java.util.Scanner; public class AreaOfTriangle { public static void main(String args[]){ int height, base, area; Scanner sc = new Scanner(System.in); System.out.println("Enter the height of the triangle ::"); height = sc.nextInt(); System.out.println("Enter the base of the triangle ::"); base = sc.nextInt(); area = (height* base); System.out.println("Area of the triangle is ::"+area); } }

## Output

Enter the height of the triangle :: 14 Enter the base of the triangle :: 5 Area of the triangle is ::70

- Related Articles
- Java program to find the area of a square
- Java program to find the area of a rectangle
- Java program to find the area of a circle
- Java Program to Find the Area of a Parallelogram
- Java Program to Find the Area of a Trapezium
- Golang Program to Find the Area of a Triangle Given All Three Sides
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Java Program to calculate the area of a triangle using Heron's Formula
- Java Program to find all angles of a triangle
- Java Program to Find Area of Square
- Find the Area of a Circle in Java Program
- How to find the area of the triangle?
- C++ Program to Compute the Area of a Triangle Using Determinants
- Java Program to Find the Surface area and Volume of Cuboid
- How To Find Minimum Height of the Triangle with Given Base and Area in Java?

Advertisements