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)
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;
}
Comments
Leave a comment