Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** ejercicio 1, trabajo 2 CONSTRUIR UN TRIANGULO
- @autor Paola Vasquez, David Cordero, Sol Contreras
- ciclo 2014-2015
- */
- import java.util.Scanner;
- public class Ejercicio1
- {
- public static void main(String [] Args)
- {
- double l1,l2,l3;
- Scanner real = new Scanner(System.in);
- System.out.println("Ingrese un valor para el lado 1");
- l1=real.nextDouble();
- System.out.println("Ingrese un valor para el lado 2");
- l2=real.nextDouble();
- System.out.println("Ingrese un valor para el lado 3");
- l3=real.nextDouble();
- if (((l1+l2)>l3)&&((l1+l3)>l2)&&((l2+l3)>l1))
- {
- System.out.println("El perímetro es: "+ (l1+l2+l3));
- if((l1==l2)^(l1==l3)^(l2==l3))
- System.out.println("El triángulo es isóceles");
- else
- {
- if((l1==l2)&&(l2==l3))
- System.out.println("El triángulo es equilátero");
- else
- System.out.println("El triángulo es escaleno");
- }
- }
- else
- System.out.println("No se puede construir el triangulo");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement