13/12/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

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: