# TOPIC

#### ๖๓๓๖๐๕๐๗ Kittipong Jindawattanachai asked 5 months ago

Hello, could someone point out mistakes in my code? Everytime I submit my code it says "wrong answer 50%", however, when I try running it in VS Code and putting in the input provided in the problem page, it seems to print output correctly. I would be glad if someone can help me with this.

``````#include <stdio.h>
#include <stdbool.h>

int main()
{
double side[3], sideA, sideB, sideC, exception;
int index = 0;
bool IsSideBFilled = false;

scanf("%lf %lf %lf", &side[0], &side[1], &side[2]);
for (index; index < 3; index++)
{

if (side[index] > sideA)
{
sideA = side[index];
exception = index;
}
}

for (index = 0; index < 3; index++)
{
if (index != exception)
{
if (IsSideBFilled)
{
sideC = side[index];
}
else
{
sideB = side[index];
IsSideBFilled = true;
}
}
}

if (sideA >= sideB + sideC)
{
printf("NAO FORMA TRIANGULO\n");
}
else if (sideA * sideA == sideB * sideB + sideC * sideC)
{
printf("TRIANGULO RETANGULO\n");
}

else if (sideA * sideA > sideB * sideB + sideC * sideC)
{
printf("TRIANGULO OBTUSANGULO\n");
}

else if (sideA * sideA < sideB * sideB + sideC * sideC)
{
printf("TRIANGULO ACUTANGULO\n");
}

if (sideA == sideB && sideB == sideC)
{
printf("TRIANGULO EQUILATERO\n");
}
else if (sideA == sideB || sideA == sideC || sideC == sideB)
{
printf("TRIANGULO ISOSCELES\n");
}
``````

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

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