Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Finding square root without using sqrt function?

// 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;
}
 
PREVIOUS NEXT
Tagged: #Finding #square #root #sqrt
ADD COMMENT
Topic
Name
8+5 =