Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Finding square root without using sqrt function?

#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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Finding #square #root #sqrt
ADD COMMENT
Topic
Name
9+9 =