Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/purvgwtw/public_html/tutorials/common.php on line 7
Java find area of triangle
Sponsered Links
Sponsered Links

Java find area of triangle

In this article, we are going to find the area of triangle.

import java.util.*;

public class AreaOfTriangle
    public static void main(String []args){
    Scanner scanner = new Scanner(;
    System.out.print("Enter base (in cm): ");
    double b = scanner.nextDouble();
    System.out.print("Enter height (in cm): ");
    double h = scanner.nextDouble();
    double area=b*h*1/2;
    System.out.println("Area of Triangle =" +area);

Sponsered Links
Latest Updates
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2014 PURVACOMPUTERS.COM All Right Reserved