area triangulo

package areatriangulo; import java.util.Scanner; public class Areatriangulo { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); double a, b, c, p, area; System.out.println("Digite el primer lado: "); a = entrada.nextDouble(); System.out.println("Digite el segundo lado: "); b = entrada.nextDouble(); System.out.println("Digite el tercer lado: "); c = entrada.nextDouble(); if(a == b && a== c && b==c) System.out.println("Es equilatero"); else if (a == b ||a == c || b == c) System.out.println("Es isosceles"); else System.out.println("Es escaleno"); p = (a + b + c)/2; area = Math.sqrt(p*(p-a)*(p-b)*(p-c)); System.out.println("El area del triangulo es: " + area); } }

1 Response

disculpa soy un poco ignorante, me podrias explicar la operacion que usaste para calcular el area?

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.