// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
double SqrtNumber (double num){
double temp = 0;
double sqrt=num/2;
while(sqrt!=temp)
{
temp=sqrt;
sqrt=(num/sqrt+sqrt)/2;
}
}
int main() {
cout <<SqrtNumber(4);
return 0;
}
#include<iostream>
using namespace std;
double SqrtNumber (double num){
if(num<=0){
return 0;
}
int counter = ceil(num/2);
for(int i=2;i<=counter;i++){
if(i*i == num){
return i;
}
}
return 0;
}