Current location - Training Enrollment Network - Mathematics courses - Mathematical sentence judgment
Mathematical sentence judgment
There is no semicolon after the if () form, so if does not correspond to else, and the semicolon should be removed.

There is a slight error in the program. A==b==c is incorrect. It should be written as a = = b&; & ampA==c, otherwise the program cannot judge the equilateral triangle.

# include & ltstdio.h & gt

# include & ltmath.h & gt

int main()

{

baidouble a、b、c;

printf("Please Old2 input a,b,c:\ n ");

Scanf("%lf%lf%lf ",& one, & c);

If (A>0 & AMPB & GT0 & AMPC & GT0 & AMPA+B > c & amp& ampa+c & gt; b & amp& ampb+ c & gt; answer

{

duif(a = = b & amp; & ampb==c)

Printf ("equilateral triangle zhi");

else if(a = = b & amp; & Answer! = C || A = = C & Answer! = b | | b = = c & amp& ampb! =a)

Printf ("isosceles triangle");

else if(a * a+b * b = = c * c | | b * b+c * c = = a * a | | a * a+c * c = = b * b)

Printf ("right knife triangle");

else if(a = = b & amp; & Answer! = C || A = = C & Answer! = b | | b = = c & amp& ampb! = b & amp& ampa * a+b * b = = c * c | | b * b+c * c = = a * a | | a * a+c * c = = b * b)

Printf ("isosceles right triangle");

other

Printf ("general triangle");

}

other

Prinf ("old2 stupid! ! ! \ n ");

Returns 0;

}

Extended data:

The general form of the if statement is as follows:

If (expression) statement

[else statement]

The "expression" in the if statement can be relational expression, logical expression or even numerical expression. Among them, relational expression is the most intuitive and easy to understand. The so-called relationship is a formula for comparing two numerical values.

If-else statement introduces an ambiguity problem else (dangling -else problem), which appears when there are more if clauses than else clauses. The question is which if clause these else clauses match respectively.

Baidu encyclopedia -if statement