Q:

Java Program to Find Area of Triangle With Output and Explanation

0

ava program to find Area of Triangle with Output and Explanation or Java program to calculate area of Triangle or Java Program to Find the Area of a Triangle Given Three Sides or How to Calculate Area of Triangle in Java or How to calculate Area of Triangle through a Java program or Java Program To Calculate Area Of Right Triangle.

Explanation:- 

For finding the Area of Triangle we need to height and base of the triangle after that just put the height and base in given below formula, here you are done now the program will return the area of the triangle. We know that if the triangle is right angle than we can find the area of triangle by given formula show that

Formula:-

Area of Triangle = ( Height * Base ) / 2

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;
class trianglearea 
{
   public static void main(String args[]) 
   {   
      Scanner scanner = new Scanner(System.in);

      System.out.println("Enter the width of the Triangle:");
      double base = scanner.nextDouble();

      System.out.println("Enter the height of the Triangle:");
      double height = scanner.nextDouble();

      double area = (base* height)/2;
      System.out.println("Area of Triangle is: " + area);      
   }
}

 

Output:

Enter the width of the Triangle:

56.369

Enter the height of the Triangle:

963.258

Area of Triangle is: 27148.945101

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now