+ 8
[challenge] program to finds square root and cube root
[challenge] make a program that finds square root and cube root of number entered by user RULES NO use of function especially in build function like power function, sqrt function , etc. you can use any language.
14 ответов
+ 14
here is my try ☺
//without in build functions or libraries
https://code.sololearn.com/cOOLnGNehbOh/?ref=app
+ 11
Without libraries :
https://code.sololearn.com/cJjPLJy1U87C/?ref=app
+ 5
I thought he sad no inbuilt functions?
+ 4
https://code.sololearn.com/Wt4FNi6LoLTZ/?ref=app
+ 4
This is by c++ and just for "integer" outputs
https://code.sololearn.com/c3AFfzRJDV1J/#cpp
( edited and fixed the code to don't break the rule )
+ 3
Can I use the ** operator?
Else it is really hard but there's an algorithm for an approximate
+ 3
https://code.sololearn.com/cex5AHqmrhKU/?ref=app
https://code.sololearn.com/cByeo2cUVHpR/?ref=app
My sollution in Java. Detailed description in the block comment
The second one is the same sollution, but now using Math.pow( ) method to the ones who likes to improve and expand horizons :)
+ 2
Fastest when you only need an integer solution https://code.sololearn.com/cJCYuZOgG3vC/?ref=app
+ 1
It is not much of a challenge to use the ** operator (e.g., x**(1.0/n)). There is no function needed to find roots anyway!
+ 1
Now includes square root and cube root integer, quick convergence
https://code.sololearn.com/cJCYuZOgG3vC/?ref=app
+ 1
My solution, computing nth root of a number with an arbitrary precision: https://code.sololearn.com/W3Jn8Qe61BBR/?ref=app
+ 1
https://code.sololearn.com/cCdmpYYAGzKe/?ref=app
0
Compares 3 methods : fastsqr binsqr and the naive method used by many solutions proposed here
https://code.sololearn.com/cJCYuZOgG3vC/?ref=app