Created
June 2, 2018 18:28
-
-
Save thmain/342e3e3801e032b01fc02403262e7a89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AreaOfTriangle { | |
public static void area(double a, double b, double c){ | |
//get the semi parameter | |
double s = (a + b + c)/2; | |
//find the area of triangle | |
double area = Math.sqrt(s*(s-a)*(s-b)*(s-c)); | |
System.out.println("Area of triangle : " + area + " sq unit"); | |
} | |
public static void main(String[] args) { | |
double a = 3.5; | |
double b = 4.5; | |
double c = 6.0; | |
area(a,b,c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment