Tuesday, 13 December 2016

Java Program To Find Area Of Triangle

Area Of Triangle:-To Find the Area Of Triangle we need to height and base . given formula show that 

Area = ( Height * Base )/2 

JavaProgram To Find Area Of Triangle


See Also :- C Program To Display Area Of Triangle

Solution :-

/* 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

No comments:
Write comments

Recommended Posts × +