12/13/2016

Java Program to Find Area of Triangle With Output and Explanation

Problem:- Java 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


Java Program to Find Area of Triangle With Output


See Also:- C Program To Display Area Of Triangle



Java Program to Find Area of Triangle With Output and Explanation



/* Program By Ghanendra Yadav
   Visit http://www.programmingwithbasics.com/
*/
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);      
   }
}


See Also:- C++ Program To Display Area Of Triangle

Output:-


Java Program to Find Area of Triangle With Output



You May Also See

No comments:

Post a Comment