0
I’m doing java exercise, but I can’t find a logic for this: Receive 6 numbers representing measures a,b,c,d,e,f and relate how many and which triangles can be formed using these measures.(To form a triangle the sum of the shorter sides must be greater than the measure of the longer side) Output example [abc], [Abd]... I can make logic with 3 values only
System.out.print("Informe a primeira medida: ");
int a = sc.nextInt();
System.out.print("Informe a segunda medida: ");
int b = sc.nextInt();
System.out.print("Informe a terceira medida: ");
int c = sc.nextInt();
System.out.print("Informe a quarta medida: ");
int d = sc.nextInt();
System.out.print("Informe a quinta medida: ");
int e = sc.nextInt();
System.out.print("Informe a sexta medida: ");
int f = sc.nextInt();
if((a+b>c) && (a+c>b) && (b+c>a)){
if(a == b && a == c){
System.out.println("Triangulo equilatero.");
}
else if((a == b) || (a == c) || (b == c)){
System.out.println("Triangulo isosceles.");
}
else{
System.out.println("Triangulo escaleno.");
}
System.out.println("Medidas usadas: [abc]");
}
else{
System.out.println("Nao forma triangulo.");
}