C#!please tell me the algorithm for factoring the number) I'm new in c# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C#!please tell me the algorithm for factoring the number) I'm new in c#

I want to know the root of a number in a simple way, I decided to break it into a set first, how to do it, without resorting to methods(sqrt)?

14th Jun 2018, 11:43 AM
Mystery
Mystery - avatar
1 Answer
+ 3
If I understand right your question - if you mean square root you can use Math.sqrt (number) method, if you mean third, fourh ... root you can use Math.pow(number, 1/n), where n is the root you want to calculate. Otherwise there are different mathematical methods for calculation (for example Babylonian method) but they are not so simple and the result is approximate. So I think it is better to use built-in methods.
14th Jun 2018, 11:58 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar