Pasindu want to make an app to find the positive square root of real numbers. So help him to do.
You can use any programming language to complete this task.
You can't exceed the range of inputs given.
You have to print negatives and positives separately.
Happy Coding..!
You can't exceed the range of inputs given.
You have to print negatives and positives separately.
Happy Coding..!
SAMPLE INPUTS:
255 144 -0.25 -25 0.5 -163
This comment has been removed by the author.
ReplyDelete#include
ReplyDelete#include
#include
#include
using namespace std;
double squareroot (double x){
return sqrt(x);
}
int main()
{
double num;
do{
cin>>num;
if(num<0){
num= -num;
double y = squareroot(num);
cout<<"square root:"<<y<<"i"<<endl;//i=sqrt(-1);
}
else{
double z = squareroot(num);
cout<<"square root:"<<z<<endl;
}
}
while(num !=0);
return 0;
}
Really i do not know how to find square root of negative numbers, but i have read that i=square root (-1)
DeleteSquare roots of negative numbers are imaginary numbers
Delete