You have several problems in your algorithm, I will point out only the syntax problems which refers to your question:
Line 16
error: 'else' without a previous 'if'
What problem are you accusing?
The else does not have a if.. That’s because you’re using character ; in the reserved word if and else, which is causing problems with the syntax when compiling the algorithm.
Let’s analyze your algorithm straight to error:
if((med1+med2>med3) && (med2+med3>med1) && (med1+med3>med2)); << REMOVA O (;)
{
//código
} else; // << REMOVA O (;)
{
//código
}
In order for the compiler to understand the syntax of your algorithm, you can do this snippet of code in two ways, which are the following:
I) REMOVE THE CHARACTER ; AND RETURN INSIDE THE ELSE, AND ALIGNS CORRECTLY FOR GOOD PRACTICES THE KEYS {}
if((med1+med2>med3) && (med2+med3>med1) && (med1+med3>med2)) {
//código
} else {
//código
}
II) REMOVE THE CHARACTER ;, AND SET UP A TERNARY OPERATOR WITH THE CONDITION STRUCTURE
(med1+med2>med3) && (med2+med3>med1) && (med1+med3>med2) ? printf("\n") : printf("Medidas não formam um triangulo");
NOTE:
TO BETTER UNDERSTAND HOW THE COMPILER OF A PROGRAMMING LANGUAGE WORKS, YOU MUST STUDY THE FOLLOWING CONTENTS:
- Ling Automata. Formal and Computability
- Compilers
You have placed a ; at the end of the if which terminated the command. Troque if((med1+med2>med3) && (med2+med3>med1) && (med1+med3>med2)); by if((med1+med2>med3) && (med2+med3>med1) & (med1+med3>med2)) Idem after Else.
– anonimo
And there’s another
;shortly after theelse, also remove it– hkotsubo