write a java program to calculate are of a triangle whit sides 16.5, 14.6, 26 cm
Today We Will learn to find the area of a triangle using java
we know that area of triangle is half*base*height but here we will use the heron’s formula which will be like Area of triangle is equal to Square root of s(s – a)(s – b)(s – c) Where Is Semi Perimeter is s so now you getting how you can find semi perimeter in java it is very easy to find semi perimeter Firstly Find perimeter sum of all Side and semi perimeter is equal to half of perimeter
For Example
public class Main {
public static void main(String[] args) {
double side1=16.5,side2=14.6,side3=26;
double area,s=0;
//finding semi perimeter
s=(side1+side2+side3)/2;
area=Math.sqrt(s*(s-side1)*(s-side2)*(s-side3));
System.out.println("Area Of A triangle is "+area);
}
}
How To Find Square root in java Click Here
Today We Have Learned how you can find semi perimeter in java
how to find area of triangle in java
דירות דיסקרטיות בירושלים — israelnightclub.com
Good post. I learn something new and challenging on sites I stumbleupon every day. It will always be exciting to read through content from other writers and use a little something from other sites.