TOPIC

Wrong answer (100%)

Luiz Gustavo asked 4 months ago

Os outputs batem mas deve ter alguma coisa errada ou faltando no codigo que eu não consigo achar.

#include <stdio.h>
#include <math.h>

int main(){
  int i, j;
  double num[3];

  //leitura dos valores
  for (i = 0; i < 3; i++) {
    scanf("%lf",&num[i]);
  }

  //ordenação decrescente
  for (i = 0; i < 3; i++) {
    for (j = i; j < 3; j++) {
      if (num[i] < num[j]) {
        int temp = num[i];
        num[i] = num[j];
        num[j] = temp;
      }
    }
  }

  //ifs dos triangulos
  if (num[0] >= (num[1] + num[2])) {
    printf("NAO FORMA TRIANGULO\n");
  }
  if (pow(num[0],2.0) == (pow(num[1],2.0) + pow(num[2],2.0))) {
    printf("TRIANGULO RETANGULO\n");
  }
  if (pow(num[0],2.0) > (pow(num[1],2.0) + pow(num[2],2.0))) {
    printf("TRIANGULO OBTUSANGULO\n");
  }
  if (pow(num[0],2.0) < (pow(num[1],2.0) + pow(num[2],2.0))) {
    printf("TRIANGULO ACUTANGULO\n");
  }
  if (num[0] == num[1] && num[0] == num[2] && num[1] == num[2]) {
    printf("TRIANGULO EQUILATERO\n");
  }
  if ((num[0] == num[1] && num[0] != num[2]) || (num[0] != num[1] && num[0] == num[2]) || (num[0] != num[1] && num[0] != num[2])) {
    printf("TRIANGULO ISOCELES\n");
  }

  return 0;
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.