Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. /** ejercicio 1, trabajo 2   CONSTRUIR UN TRIANGULO
  2.     @autor Paola Vasquez, David Cordero, Sol Contreras
  3.     ciclo 2014-2015
  4. */
  5.  
  6. import java.util.Scanner;
  7.  
  8. public class Ejercicio1
  9. {
  10.     public static void main(String [] Args)
  11.     {
  12.         double l1,l2,l3;
  13.         Scanner real = new Scanner(System.in);
  14.         System.out.println("Ingrese un valor para el lado 1");
  15.         l1=real.nextDouble();
  16.         System.out.println("Ingrese un valor para el lado 2");
  17.         l2=real.nextDouble();
  18.         System.out.println("Ingrese un valor para el lado 3");
  19.         l3=real.nextDouble();
  20.  
  21.         if (((l1+l2)>l3)&&((l1+l3)>l2)&&((l2+l3)>l1))
  22.         {
  23.             System.out.println("El perímetro es: "+ (l1+l2+l3));
  24.             if((l1==l2)^(l1==l3)^(l2==l3))
  25.                 System.out.println("El triángulo es isóceles");
  26.             else
  27.             {
  28.             if((l1==l2)&&(l2==l3))
  29.                 System.out.println("El triángulo es equilátero");
  30.             else
  31.                 System.out.println("El triángulo es escaleno");
  32.             }
  33.         }
  34.         else
  35.             System.out.println("No se puede construir el triangulo");
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement