## Java Program to find area of triangle

### Description

```Get base width and height of triangle and find area of triangle
Input 1:
4 5
Output1:
10
```

### Solution

```import java.util.*;
class Triangle
{

public static void main(String args[])
{

double base,height;
double area;
Scanner sc=new Scanner(System.in);
System.out.println("Get base and height of Triangle and find area of Triangle");
System.out.println("Enter The Input 1:");
base=sc.nextInt();
System.out.println("Enter The Input 2:");
height=sc.nextInt();
area=0.5*base*height;
System.out.println("The Output 1 Is:\n"+area);

}

}```

We are Teaching "Web Development using Python" through Online.

View Tutor Profile and Course Syllabus

### Explanation

```Get height and base of a  triangle (using scanner class)

Calculate area by multiplying product of height and base by 0.5  (area = base * height*0.5)

print area (using system.out.println)```

#### Author - Ramesh P Natarajan

Software Developer and Technology Trainer, very much passionate in the field of Software Application Development, Machine Learning and Search Engine Optimization.

Write to: [email protected]

### Interesting Pattern Programs: for more Patterns

```Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution```
```Input:
5
Output:
*
***
*****
*******
*********
*******
*****
***
*Solution```
```Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution```
```Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution```
```Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution```
```Input:
5
Output:
*********
*******
*****
***
*
***
*****
*******
*********Solution```