Y=x2 + 10 (x <5)
Y=(x + 1) * (x + 5) <=(- 5 x <0)
Y=x (x=0)
Y=x - 2 (0
Out, I want to use the if the else structure found that logic is wrong, who can type the complete code, I compare,
CodePudding user response:
If you can, take explanation, by the wayCodePudding user response:
Reference:# include
Int main (int arg c, char * argv [])
{
Float x, y;
Printf (" input x: ");
The scanf (" % f ", & amp; X);
If (x<5)
{
X + y=x * 10;
Printf (" y=% f \ n ", y);
}
If (x & gt;=5 & amp; & X & lt; 0)
{
Y=(x + 1) * (x + 5) + 0.000000001;//to avoid - 0.00
the condition of thePrintf (" y=% f \ n ", y);
}
If (x==0)
{
Y=x;
Printf (" y=% f \ n ", y);
}
If (x> 0 & amp; & x<10)
{
Y=x - 2;
Printf (" y=% f \ n ", y);
}
If (x>=10)
{
Y=x + 25;
Printf (" y=% f \ n ", y);
}
system("pause");
return 0;
}
CodePudding user response: