Answers for "how to find the area of a triangle"

12

how to find the area of a triangle

#this is the code to find the area of a parrelogram and triangle
#change the numbers to select what height and base your shape is

b = 3 #b is base 
h = 3 #h is height (middle)


t = 5 #this is the base of the triangle
i = 5 #and this is the height
p = t*i #dont touch this


print("this is the area of the parrelogram")
print(b * h)

m = input("do you want to calculate a triangle? (space before answer)") 

print(m)

if m == " yes":
    print ("this is the area of the triangle that you inputed")
    print (p/2)
else:
    print("ok")
Posted by: Guest on April-30-2020
4

triangle area formula

double traingleArea  = base * height / 2;
Posted by: Guest on January-25-2021
0

how to calculate the area of triangle

first you should know these details about the triangle(for the area) - 
hight (center)
and the base lenght

now, mutiply the height by the base and divide it by '2'

//code
var base = 5
var height = 9
var ans = (base * height) / 2
console.log(ans)
Posted by: Guest on July-15-2021
1

area of triangle

import java.util.Scanner;

public class shw2point15 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("Enter three points for a triangle:");

        double x1 = input.nextDouble();
        double y1 = input.nextDouble();
        double x2 = input.nextDouble();
        double y2 = input.nextDouble();
        double x3 = input.nextDouble();
        double y3 = input.nextDouble();


        double s = ((x1 + y1) + (x2 + y2) + (x3 + y3)) / 2;
        double area = Math.sqrt(s * (s - (x1 - y1)) * (s - (x2 - y2)) * (s - (x3 - y3)));



        System.out.println("The area of the triangle is " + area);
    }
}
Posted by: Guest on April-30-2021

Code answers related to "how to find the area of a triangle"

Python Answers by Framework

Browse Popular Code Answers by Language