[challenge] program to finds square root and cube root | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

4th Dec 2017, 9:16 AM
Gamer
Gamer - avatar
14 Answers
+ 14
here is my try ☺ //without in build functions or libraries https://code.sololearn.com/cOOLnGNehbOh/?ref=app
23rd Dec 2017, 9:52 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
6th Dec 2017, 7:03 AM
LukArToDo
LukArToDo - avatar
+ 5
I thought he sad no inbuilt functions?
4th Dec 2017, 10:32 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
4th Dec 2017, 10:09 AM
Calviղ
Calviղ - avatar
+ 4
https://code.sololearn.com/Wt4FNi6LoLTZ/?ref=app
4th Dec 2017, 10:32 AM
Calviղ
Calviղ - avatar
+ 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 )
4th Dec 2017, 6:18 PM
Light
Light - avatar
+ 3
Can I use the ** operator? Else it is really hard but there's an algorithm for an approximate
4th Dec 2017, 9:23 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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 :)
5th Dec 2017, 4:39 PM
Jonathan Álex
Jonathan Álex - avatar
+ 2
Fastest when you only need an integer solution https://code.sololearn.com/cJCYuZOgG3vC/?ref=app
4th Dec 2017, 12:30 PM
VcC
VcC - avatar
+ 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!
4th Dec 2017, 6:05 PM
Brian
Brian - avatar
+ 1
Now includes square root and cube root integer, quick convergence https://code.sololearn.com/cJCYuZOgG3vC/?ref=app
4th Dec 2017, 6:18 PM
VcC
VcC - avatar
+ 1
My solution, computing nth root of a number with an arbitrary precision: https://code.sololearn.com/W3Jn8Qe61BBR/?ref=app
5th Dec 2017, 1:42 AM
Luc Hariman Randrianomenjanahary
Luc Hariman Randrianomenjanahary - avatar
+ 1
https://code.sololearn.com/cCdmpYYAGzKe/?ref=app
3rd Jan 2018, 10:35 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
0
Compares 3 methods : fastsqr binsqr and the naive method used by many solutions proposed here https://code.sololearn.com/cJCYuZOgG3vC/?ref=app
5th Dec 2017, 7:17 AM
VcC
VcC - avatar