Answer to Question #151558 in C++ for Nasilele Munalula

Question #151558

write a code that gives you the value of y in the function y={x(x<1) 2x^2-1(1<=x<20) 3x^2+1(x>=20)


1
Expert's answer
2020-12-17T11:30:25-0500
double function(double x) {
    double y;
    
    if (x < 1.0)
        y = x;
    else if (x < 20.0)
        y = 2.0 * x * x - 1.0;
    else
        y = 3.0 * x * x + 1.0;

    return y;                    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog