Area Of Tringle
previous NextExample
import java.util.Scanner;
class Area_Triangle
{
public static void main(String[] args) {
int b;
int h;
float area;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the values of breadth an and height:");
b = sc.nextInt();
h = sc.nextInt();
area = (float)(b*h)/2;
System.out.println("Area of the triangle ="+area);
}
}
Output :
Enter the values of breadth and and height:
10
15
Area of the triangle =75.0