Write C instructions to find yx after the user enters a valu

Write C++ instructions to find y(x) after the user enters a value for x

Write C++ instructions to find y(x) after the user enters a value for x y(x) = {0 x

Solution

#include<iostream>
using namespace std;
int main(){
int y,x;
cout<<\"Please Enter a value:\";
cin>>x;
if (x<0)
y=0;
else if (x>=0 && x<3)
y=2*x;
else if (x>=3 && x<6)
y=3*x*x;
else
y=4*x*x*x;
cout<<\"y(\"<<x<<\")=\"<<y;
return 0;
}
  

OUTPUT:

Please Enter a value: 5

y(5)=75

Write C++ instructions to find y(x) after the user enters a value for x Write C++ instructions to find y(x) after the user enters a value for x y(x) = {0 x Solu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site