#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x,y;
cin>>x;
if (x<0)
y=x*x;
}
else
y= sqrt(x);
cout<<y;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x,y;
cin>>x;
if (x<0)
{
y=x*x;
}
else
y= sqrt(x);
cout<<y;
return 0;
}