#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main()
{
int x;
float y;
cout << "x :";
cin >> x;
if (x > 0){
y = 1 / (pow(x,2)) - 6;
}
else{
y = pow(x,2)-x-9;
cout << "y: " << y << endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main()
{
int x;
float y;
cout << "x :";
cin >> x;
if (x > 0){
y = 1 / (pow(x,2)) - 6;
}
else{
y = pow(x,2)-x-9;
}
cout << "y: " << y << endl;
}